{
  "version": 3,
  "sources": ["../../../../src/packages/plugin-commands-server/server.ts"],
  "sourcesContent": ["import { docsUrl } from '../cli-utils/index.ts';\nimport {\n  OPTIONS,\n  UNIVERSAL_OPTIONS,\n} from '../common-cli-options-help/index.ts';\nimport { types as allTypes } from '../config/index.ts';\nimport { PnpmError } from '../error/index.ts';\nimport type { CreateStoreControllerOptions } from '../store-connection-manager/index.ts';\nimport pick from 'ramda/src/pick';\nimport renderHelp from 'render-help';\nimport { start } from './start.ts';\nimport { status } from './status.ts';\nimport { stop } from './stop.ts';\n\nexport const rcOptionsTypes = cliOptionsTypes;\n\nexport function cliOptionsTypes(): Record<string, unknown> {\n  return {\n    ...pick.default(['store-dir'], allTypes),\n    background: Boolean,\n    'ignore-stop-requests': Boolean,\n    'ignore-upload-requests': Boolean,\n    port: Number,\n    protocol: ['auto', 'tcp', 'ipc'],\n  };\n}\n\nexport const commandNames = ['server'];\n\nexport function help(): string {\n  return renderHelp({\n    description: 'Manage a store server',\n    descriptionLists: [\n      {\n        title: 'Commands',\n\n        list: [\n          {\n            description:\n              '\\\nStarts a service that does all interactions with the store. \\\nOther commands will delegate any store-related tasks to this service',\n            name: 'start',\n          },\n          {\n            description: 'Stops the store server',\n            name: 'stop',\n          },\n          {\n            description: 'Prints information about the running server',\n            name: 'status',\n          },\n        ],\n      },\n      {\n        title: 'Start options',\n\n        list: [\n          {\n            description: 'Runs the server in the background',\n            name: '--background',\n          },\n          {\n            description: 'The communication protocol used by the server',\n            name: '--protocol <auto|tcp|ipc>',\n          },\n          {\n            description:\n              'The port number to use, when TCP is used for communication',\n            name: '--port <number>',\n          },\n          OPTIONS.storeDir,\n          {\n            description: 'Maximum number of concurrent network requests',\n            name: '--network-concurrency <number>',\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            name: '--[no-]lock',\n          },\n          {\n            description:\n              'Disallows stopping the server using `pnpm server stop`',\n            name: '--ignore-stop-requests',\n          },\n          {\n            description:\n              'Disallows creating new side effect cache during install',\n            name: '--ignore-upload-requests',\n          },\n          ...UNIVERSAL_OPTIONS,\n        ],\n      },\n    ],\n    url: docsUrl('server'),\n    usages: ['pnpm server <command>'],\n  });\n}\n\nexport function handler(\n  opts: CreateStoreControllerOptions & {\n    protocol?: 'auto' | 'tcp' | 'ipc' | undefined;\n    port?: number | undefined;\n    unstoppable?: boolean | undefined;\n  },\n  params: string[]\n): Promise<void> | undefined {\n  // We can only support TCP at the moment because node-fetch does not support IPC\n  opts.protocol = 'tcp';\n\n  switch (params[0]) {\n    case 'start': {\n      return start(opts);\n    }\n\n    case 'status': {\n      return status(opts);\n    }\n\n    case 'stop': {\n      return stop(opts);\n    }\n\n    default: {\n      help();\n\n      if (typeof params[0] !== 'undefined') {\n        throw new PnpmError(\n          'INVALID_SERVER_COMMAND',\n          `\"server ${params[0]}\" is not a pnpm command. See \"pnpm help server\".`\n        );\n      }\n\n      return undefined;\n    }\n  }\n}\n"],
  "mappings": "AAAA,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,gBAAgB;AAClC,SAAS,iBAAiB;AAE1B,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,YAAY;AAEd,MAAM,iBAAiB;AAEvB,SAAS,kBAA2C;AACzD,SAAO;AAAA,IACL,GAAG,KAAK,QAAQ,CAAC,WAAW,GAAG,QAAQ;AAAA,IACvC,YAAY;AAAA,IACZ,wBAAwB;AAAA,IACxB,0BAA0B;AAAA,IAC1B,MAAM;AAAA,IACN,UAAU,CAAC,QAAQ,OAAO,KAAK;AAAA,EACjC;AACF;AAEO,MAAM,eAAe,CAAC,QAAQ;AAE9B,SAAS,OAAe;AAC7B,SAAO,WAAW;AAAA,IAChB,aAAa;AAAA,IACb,kBAAkB;AAAA,MAChB;AAAA,QACE,OAAO;AAAA,QAEP,MAAM;AAAA,U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