{
  "version": 3,
  "sources": ["../../../../src/packages/plugin-commands-installation/install.ts"],
  "sourcesContent": ["import { docsUrl } from '../cli-utils/index.ts';\nimport {\n  FILTERING,\n  OPTIONS,\n  OUTPUT_OPTIONS,\n  UNIVERSAL_OPTIONS,\n} from '../common-cli-options-help/index.ts';\nimport { type Config, types as allTypes } from '../config/index.ts';\nimport { WANTED_LOCKFILE } from '../constants/index.ts';\nimport { prepareExecutionEnv } from '../plugin-commands-env/index.ts';\nimport type { CreateStoreControllerOptions } from '../store-connection-manager/index.ts';\nimport { isCI } from 'ci-info';\nimport pick from 'ramda/src/pick';\nimport renderHelp from 'render-help';\nimport { installDeps, type InstallDepsOptions } from './installDeps.ts';\n\nexport function rcOptionsTypes(): Record<string, unknown> {\n  return pick.default(\n    [\n      'cache-dir',\n      'child-concurrency',\n      'dev',\n      'engine-strict',\n      'fetch-retries',\n      'fetch-retry-factor',\n      'fetch-retry-maxtimeout',\n      'fetch-retry-mintimeout',\n      'fetch-timeout',\n      'frozen-lockfile',\n      'global-dir',\n      'global-pnpmfile',\n      'global',\n      'hoist',\n      'hoist-pattern',\n      'https-proxy',\n      'ignore-pnpmfile',\n      'ignore-scripts',\n      'optimistic-repeat-install',\n      'link-workspace-packages',\n      'lockfile-dir',\n      'lockfile-directory',\n      'lockfile-only',\n      'lockfile',\n      'merge-git-branch-lockfiles',\n      'merge-git-branch-lockfiles-branch-pattern',\n      'modules-dir',\n      'network-concurrency',\n      'node-linker',\n      'noproxy',\n      'package-import-method',\n      'pnpmfile',\n      'prefer-frozen-lockfile',\n      'prefer-offline',\n      'production',\n      'proxy',\n      'public-hoist-pattern',\n      'registry',\n      'reporter',\n      'save-workspace-protocol',\n      'scripts-prepend-node-path',\n      'shamefully-flatten',\n      'shamefully-hoist',\n      'shared-workspace-lockfile',\n      'side-effects-cache-readonly',\n      'side-effects-cache',\n      'store-dir',\n      'strict-peer-dependencies',\n      'offline',\n      'only',\n      'optional',\n      'unsafe-perm',\n      'use-running-store-server',\n      'use-store-server',\n      'verify-store-integrity',\n      'virtual-store-dir',\n    ],\n    allTypes\n  );\n}\n\nexport const cliOptionsTypes = (): Record<string, unknown> => ({\n  ...rcOptionsTypes(),\n  ...pick.default(['force'], allTypes),\n  'fix-lockfile': Boolean,\n  'resolution-only': Boolean,\n  recursive: Boolean,\n});\n\nexport const shorthands: Record<string, string> = {\n  D: '--dev',\n  P: '--production',\n};\n\nexport const commandNames = ['install', 'i'];\n\nexport function help(): string {\n  return renderHelp({\n    aliases: ['i'],\n    description:\n      'Installs all dependencies of the project in the current working directory. \\\nWhen executed inside a workspace, installs all dependencies of all projects.',\n    descriptionLists: [\n      {\n        title: 'Options',\n\n        list: [\n          {\n            description:\n              'Run installation recursively in every package found in subdirectories. \\\nFor options that may be used with `-r`, see \"pnpm help recursive\"',\n            name: '--recursive',\n            shortAlias: '-r',\n          },\n          OPTIONS.ignoreScripts,\n          OPTIONS.offline,\n          OPTIONS.preferOffline,\n          OPTIONS.globalDir,\n          {\n            description: \"Packages in `devDependencies` won't be installed\",\n            name: '--prod',\n            shortAlias: '-P',\n          },\n          {\n            description: 'Only `devDependencies` are installed',\n            name: '--dev',\n            shortAlias: '-D',\n          },\n          {\n            description: 'Skip reinstall if the workspace state is up-to-date',\n            name: '--optimistic-repeat-install',\n          },\n          {\n            description: '`optionalDependencies` are not installed',\n            name: '--no-optional',\n          },\n          {\n            description: `Don't read or generate a \\`${WANTED_LOCKFILE}\\` file`,\n            name: '--no-lockfile',\n          },\n          {\n            description: `Dependencies are not downloaded. Only \\`${WANTED_LOCKFILE}\\` is updated`,\n            name: '--lockfile-only',\n          },\n          {\n            description:\n              \"Don't generate a lockfile and fail if an update is needed. This setting is on by default in CI environments, so use --no-frozen-lockfile if you need to disable it for some reason\",\n            name: '--[no-]frozen-lockfile',\n          },\n          {\n            description: `If the available \\`${WANTED_LOCKFILE}\\` satisfies the \\`package.json\\` then perform a headless installation`,\n            name: '--prefer-frozen-lockfile',\n          },\n          {\n            description: `The directory in which the ${WANTED_LOCKFILE} of the package will be created. Several projects may share a single lockfile.`,\n            name: '--lockfile-dir <dir>',\n          },\n          {\n            description: 'Fix broken lockfile entries automatically',\n            name: '--fix-lockfile',\n          },\n          {\n            description: 'Merge lockfiles were generated on git branch',\n            name: '--merge-git-branch-lockfiles',\n          },\n          {\n            description:\n              'The directory in which dependencies will be installed (instead of node_modules)',\n            name: '--modules-dir <dir>',\n          },\n          {\n            description:\n              'Dependencies inside the modules directory will have access only to their listed dependencies',\n            name: '--no-hoist',\n          },\n          {\n            description:\n              'All the subdeps will be hoisted into the root node_modules. Your code will have access to them',\n            name: '--shamefully-hoist',\n          },\n          {\n            description:\n              'Hoist all dependencies matching the pattern to `node_modules/.pnpm/node_modules`. \\\nThe default pattern is * and matches everything. Hoisted packages can be required \\\nby any dependencies, so it is an emulation of a flat node_modules',\n            name: '--hoist-pattern <pattern>',\n          },\n          {\n            description:\n              'Hoist all dependencies matching the pattern to the root of the modules directory',\n            name: '--public-hoist-pattern <pattern>',\n          },\n          OPTIONS.storeDir,\n          OPTIONS.virtualStoreDir,\n          {\n            description: 'Maximum number of concurrent network requests',\n            name: '--network-concurrency <number>',\n          },\n          {\n            description:\n              'Controls the number of child processes run parallelly to build node modules',\n            name: '--child-concurrency <number>',\n          },\n          {\n            description: 'Disable pnpm hooks defined in .pnpmfile.cjs',\n            name: '--ignore-pnpmfile',\n          },\n          {\n            description:\n              'Ignore pnpm-workspace.yaml if exists in the parent directory, and treat the installation as normal non-workspace installation.',\n            name: '--ignore-workspace',\n          },\n          {\n            description:\n              \"If false, doesn't check whether packages in the store were mutated\",\n            name: '--[no-]verify-store-integrity',\n          },\n          {\n            description: 'Fail on missing or invalid peer dependencies',\n            name: '--strict-peer-dependencies',\n          },\n          {\n            description:\n              'Starts a store server in the background. The store server will keep running after installation is done. To stop the store server, run `pnpm server stop`',\n            name: '--use-store-server',\n          },\n          {\n            description:\n              'Only allows installation with a store server. If no store server is running, installation will fail',\n            name: '--use-running-store-server',\n          },\n          {\n            description:\n              'Clones/hardlinks or copies packages. The selected method depends from the file system',\n            name: '--package-import-method auto',\n          },\n          {\n            description: 'Hardlink packages from the store',\n            name: '--package-import-method hardlink',\n          },\n          {\n            description: 'Copy packages from the store',\n            name: '--package-import-method copy',\n          },\n          {\n            description: 'Clone (aka copy-on-write) packages from the store',\n            name: '--package-import-method clone',\n          },\n          {\n            description:\n              \"Force reinstall dependencies: refetch packages modified in store, \\\nrecreate a lockfile and/or modules directory created by a non-compatible version of pnpm. \\\nInstall all optionalDependencies even they don't satisfy the current environment(cpu, os, arch)\",\n            name: '--force',\n          },\n          {\n            description: 'Use or cache the results of (pre/post)install hooks',\n            name: '--side-effects-cache',\n          },\n          {\n            description:\n              'Only use the side effects cache if present, do not create it for new packages',\n            name: '--side-effects-cache-readonly',\n          },\n          {\n            description:\n              'Re-runs resolution: useful for printing out peer dependency issues',\n            name: '--resolution-only',\n          },\n          ...UNIVERSAL_OPTIONS,\n        ],\n      },\n      OUTPUT_OPTIONS,\n      FILTERING,\n    ],\n    url: docsUrl('install'),\n    usages: ['pnpm install [options]'],\n  });\n}\n\nexport type InstallCommandOptions = Pick<\n  Config,\n  | 'allProjects'\n  | 'autoInstallPeers'\n  | 'bail'\n  | 'bin'\n  | 'catalogs'\n  | 'cliOptions'\n  | 'configDependencies'\n  | 'dedupeInjectedDeps'\n  | 'dedupeDirectDeps'\n  | 'dedupePeerDependents'\n  | 'deployAllFiles'\n  | 'depth'\n  | 'dev'\n  | 'engineStrict'\n  | 'excludeLinksFromLockfile'\n  | 'frozenLockfile'\n  | 'global'\n  | 'globalPnpmfile'\n  | 'hooks'\n  | 'ignorePnpmfile'\n  | 'ignoreScripts'\n  | 'injectWorkspacePackages'\n  | 'linkWorkspacePackages'\n  | 'rawLocalConfig'\n  | 'lockfileDir'\n  | 'lockfileOnly'\n  | 'modulesDir'\n  | 'nodeLinker'\n  | 'patchedDependencies'\n  | 'pnpmfile'\n  | 'preferFrozenLockfile'\n  | 'preferWorkspacePackages'\n  | 'production'\n  | 'registries'\n  | 'rootProjectManifest'\n  | 'rootProjectManifestDir'\n  | 'save'\n  | 'saveDev'\n  | 'saveExact'\n  | 'saveOptional'\n  | 'savePeer'\n  | 'savePrefix'\n  | 'saveProd'\n  | 'saveWorkspaceProtocol'\n  | 'lockfileIncludeTarballUrl'\n  | 'allProjectsGraph'\n  | 'selectedProjectsGraph'\n  | 'sideEffectsCache'\n  | 'sideEffectsCacheReadonly'\n  | 'sort'\n  | 'sharedWorkspaceLockfile'\n  | 'tag'\n  | 'onlyBuiltDependencies'\n  | 'optional'\n  | 'virtualStoreDir'\n  | 'workspaceConcurrency'\n  | 'workspaceDir'\n  | 'workspacePackagePatterns'\n  | 'extraEnv'\n  | 'resolutionMode'\n  | 'ignoreWorkspaceCycles'\n  | 'disallowWorkspaceCycles'\n> &\n  CreateStoreControllerOptions & {\n    argv: {\n      original: string[];\n    };\n    fixLockfile?: boolean;\n    frozenLockfileIfExists?: boolean;\n    useBetaCli?: boolean;\n    pruneDirectDependencies?: boolean;\n    pruneStore?: boolean;\n    recursive?: boolean;\n    resolutionOnly?: boolean;\n    saveLockfile?: boolean;\n    workspace?: boolean;\n    includeOnlyPackageFiles?: boolean;\n    confirmModulesPurge?: boolean;\n  } & Partial<\n    Pick<\n      Config,\n      | 'modulesCacheMaxAge'\n      | 'pnpmHomeDir'\n      | 'preferWorkspacePackages'\n      | 'useLockfile'\n      | 'symlink'\n    >\n  >;\n\nexport async function handler(opts: InstallCommandOptions): Promise<void> {\n  const include = {\n    dependencies: opts.production !== false,\n    devDependencies: opts.dev !== false,\n    optionalDependencies: opts.optional !== false,\n  };\n\n  // npm registry's abbreviated metadata currently does not contain libc\n  // see <https://github.com/pnpm/pnpm/issues/7362#issuecomment-1971964689>\n  const fetchFullMetadata: true | undefined =\n    opts.rootProjectManifest?.pnpm?.supportedArchitectures?.libc && true;\n\n  const installDepsOptions: InstallDepsOptions = {\n    ...opts,\n    frozenLockfileIfExists:\n      opts.frozenLockfileIfExists ??\n      (isCI &&\n        opts.lockfileOnly !== true &&\n        typeof opts.rawLocalConfig['frozen-lockfile'] === 'undefined' &&\n        typeof opts.rawLocalConfig['prefer-frozen-lockfile'] === 'undefined'),\n    include,\n    includeDirect: include,\n    prepareExecutionEnv: prepareExecutionEnv.bind(null, opts),\n    fetchFullMetadata,\n  };\n\n  if (opts.resolutionOnly === true) {\n    installDepsOptions.lockfileOnly = true;\n    installDepsOptions.forceFullResolution = true;\n  }\n\n  return installDeps(installDepsOptions, []);\n}\n"],
  "mappings": "AAAA,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAsB,SAAS,gBAAgB;AAC/C,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AAEpC,SAAS,YAAY;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,SAAS,mBAA4C;AAE9C,SAAS,iBAA0C;AACxD,SAAO,KAAK;AAAA,IACV;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA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