@pnpm/installing.commands 1004.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +15 -0
  3. package/lib/add.d.ts +17 -0
  4. package/lib/add.js +285 -0
  5. package/lib/ci.d.ts +6 -0
  6. package/lib/ci.js +20 -0
  7. package/lib/createProjectManifestWriter.d.ts +2 -0
  8. package/lib/createProjectManifestWriter.js +17 -0
  9. package/lib/dedupe.d.ts +9 -0
  10. package/lib/dedupe.js +59 -0
  11. package/lib/fetch.d.ts +10 -0
  12. package/lib/fetch.js +75 -0
  13. package/lib/getFetchFullMetadata.d.ts +8 -0
  14. package/lib/getFetchFullMetadata.js +7 -0
  15. package/lib/getPinnedVersion.d.ts +4 -0
  16. package/lib/getPinnedVersion.js +6 -0
  17. package/lib/getSaveType.d.ts +3 -0
  18. package/lib/getSaveType.js +10 -0
  19. package/lib/import/index.d.ts +9 -0
  20. package/lib/import/index.js +238 -0
  21. package/lib/import/yarnUtil.d.ts +8 -0
  22. package/lib/import/yarnUtil.js +65 -0
  23. package/lib/index.d.ts +13 -0
  24. package/lib/index.js +13 -0
  25. package/lib/install.d.ts +28 -0
  26. package/lib/install.js +281 -0
  27. package/lib/installDeps.d.ts +41 -0
  28. package/lib/installDeps.js +349 -0
  29. package/lib/link.d.ts +9 -0
  30. package/lib/link.js +130 -0
  31. package/lib/nodeExecPath.d.ts +1 -0
  32. package/lib/nodeExecPath.js +16 -0
  33. package/lib/prune.d.ts +6 -0
  34. package/lib/prune.js +49 -0
  35. package/lib/recursive.d.ts +41 -0
  36. package/lib/recursive.js +406 -0
  37. package/lib/remove.d.ts +12 -0
  38. package/lib/remove.js +189 -0
  39. package/lib/unlink.d.ts +6 -0
  40. package/lib/unlink.js +62 -0
  41. package/lib/update/getUpdateChoices.d.ts +14 -0
  42. package/lib/update/getUpdateChoices.js +126 -0
  43. package/lib/update/index.d.ts +15 -0
  44. package/lib/update/index.js +295 -0
  45. package/lib/updateWorkspaceDependencies.d.ts +4 -0
  46. package/lib/updateWorkspaceDependencies.js +27 -0
  47. package/package.json +134 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
4
+ Copyright (c) 2016-2026 Zoltan Kochan and other contributors
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @pnpm/plugin-commands-installation
2
+
3
+ > Commands for installation
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@pnpm/plugin-commands-installation.svg)](https://www.npmjs.com/package/@pnpm/plugin-commands-installation)
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ pnpm add @pnpm/plugin-commands-installation
11
+ ```
12
+
13
+ ## License
14
+
15
+ MIT
package/lib/add.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import type { InstallCommandOptions } from './install.js';
2
+ export declare const shorthands: Record<string, string>;
3
+ export declare function rcOptionsTypes(): Record<string, unknown>;
4
+ export declare function cliOptionsTypes(): Record<string, unknown>;
5
+ export declare const commandNames: string[];
6
+ export declare function help(): string;
7
+ export type AddCommandOptions = InstallCommandOptions & {
8
+ allowBuild?: string[];
9
+ allowNew?: boolean;
10
+ ignoreWorkspaceRootCheck?: boolean;
11
+ save?: boolean;
12
+ update?: boolean;
13
+ useBetaCli?: boolean;
14
+ workspaceRoot?: boolean;
15
+ config?: boolean;
16
+ };
17
+ export declare function handler(opts: AddCommandOptions, params: string[]): Promise<void>;
package/lib/add.js ADDED
@@ -0,0 +1,285 @@
1
+ import { FILTERING, OPTIONS, UNIVERSAL_OPTIONS } from '@pnpm/cli.common-cli-options-help';
2
+ import { docsUrl } from '@pnpm/cli.utils';
3
+ import { types as allTypes } from '@pnpm/config.reader';
4
+ import { writeSettings } from '@pnpm/config.writer';
5
+ import { PnpmError } from '@pnpm/error';
6
+ import { handleGlobalAdd } from '@pnpm/global.commands';
7
+ import { resolveConfigDeps } from '@pnpm/installing.env-installer';
8
+ import { createStoreController } from '@pnpm/store.connection-manager';
9
+ import { pick } from 'ramda';
10
+ import { renderHelp } from 'render-help';
11
+ import { getFetchFullMetadata } from './getFetchFullMetadata.js';
12
+ import { installDeps } from './installDeps.js';
13
+ export const shorthands = {
14
+ 'save-catalog': '--save-catalog-name=default',
15
+ d: '--save-dev',
16
+ e: '--save-exact',
17
+ o: '--save-optional',
18
+ p: '--save-prod',
19
+ };
20
+ export function rcOptionsTypes() {
21
+ return pick([
22
+ 'cache-dir',
23
+ 'cpu',
24
+ 'child-concurrency',
25
+ 'dangerously-allow-all-builds',
26
+ 'engine-strict',
27
+ 'fetch-retries',
28
+ 'fetch-retry-factor',
29
+ 'fetch-retry-maxtimeout',
30
+ 'fetch-retry-mintimeout',
31
+ 'fetch-timeout',
32
+ 'force',
33
+ 'global-bin-dir',
34
+ 'global-dir',
35
+ 'global-pnpmfile',
36
+ 'global',
37
+ 'hoist',
38
+ 'hoist-pattern',
39
+ 'https-proxy',
40
+ 'ignore-pnpmfile',
41
+ 'ignore-scripts',
42
+ 'ignore-workspace-root-check',
43
+ 'libc',
44
+ 'link-workspace-packages',
45
+ 'lockfile-dir',
46
+ 'lockfile-directory',
47
+ 'lockfile-only',
48
+ 'lockfile',
49
+ 'modules-dir',
50
+ 'network-concurrency',
51
+ 'node-linker',
52
+ 'noproxy',
53
+ 'npm-path',
54
+ 'os',
55
+ 'package-import-method',
56
+ 'pnpmfile',
57
+ 'prefer-offline',
58
+ 'production',
59
+ 'proxy',
60
+ 'public-hoist-pattern',
61
+ 'registry',
62
+ 'reporter',
63
+ 'save-catalog-name',
64
+ 'save-dev',
65
+ 'save-exact',
66
+ 'save-optional',
67
+ 'save-peer',
68
+ 'save-prefix',
69
+ 'save-prod',
70
+ 'save-workspace-protocol',
71
+ 'shamefully-flatten',
72
+ 'shamefully-hoist',
73
+ 'shared-workspace-lockfile',
74
+ 'side-effects-cache-readonly',
75
+ 'side-effects-cache',
76
+ 'store-dir',
77
+ 'strict-peer-dependencies',
78
+ 'trust-policy',
79
+ 'trust-policy-exclude',
80
+ 'trust-policy-ignore-after',
81
+ 'unsafe-perm',
82
+ 'offline',
83
+ 'only',
84
+ 'optional',
85
+ 'verify-store-integrity',
86
+ 'virtual-store-dir',
87
+ ], allTypes);
88
+ }
89
+ export function cliOptionsTypes() {
90
+ return {
91
+ ...rcOptionsTypes(),
92
+ 'allow-build': [String, Array],
93
+ recursive: Boolean,
94
+ save: Boolean,
95
+ workspace: Boolean,
96
+ config: Boolean,
97
+ };
98
+ }
99
+ export const commandNames = ['add'];
100
+ export function help() {
101
+ return renderHelp({
102
+ description: 'Installs a package and any packages that it depends on.',
103
+ descriptionLists: [
104
+ {
105
+ title: 'Options',
106
+ list: [
107
+ {
108
+ description: 'Save package to your `dependencies`. The default behavior',
109
+ name: '--save-prod',
110
+ shortAlias: '-p',
111
+ },
112
+ {
113
+ description: 'Save package to your `devDependencies`',
114
+ name: '--save-dev',
115
+ shortAlias: '-d',
116
+ },
117
+ {
118
+ description: 'Save package to your `optionalDependencies`',
119
+ name: '--save-optional',
120
+ shortAlias: '-o',
121
+ },
122
+ {
123
+ description: 'Save package to your `peerDependencies` and `devDependencies`',
124
+ name: '--save-peer',
125
+ },
126
+ {
127
+ description: 'Save package to the default catalog',
128
+ name: '--save-catalog',
129
+ },
130
+ {
131
+ description: 'Save package to the specified catalog',
132
+ name: '--save-catalog-name=<name>',
133
+ },
134
+ {
135
+ description: 'Install exact version',
136
+ name: '--[no-]save-exact',
137
+ shortAlias: '-e',
138
+ },
139
+ {
140
+ description: 'Save packages from the workspace with a "workspace:" protocol. True by default',
141
+ name: '--[no-]save-workspace-protocol',
142
+ },
143
+ {
144
+ description: 'Install as a global package',
145
+ name: '--global',
146
+ shortAlias: '-g',
147
+ },
148
+ {
149
+ description: 'Run installation recursively in every package found in subdirectories \
150
+ or in every workspace package, when executed inside a workspace. \
151
+ For options that may be used with `-r`, see "pnpm help recursive"',
152
+ name: '--recursive',
153
+ shortAlias: '-r',
154
+ },
155
+ {
156
+ description: 'Only adds the new dependency if it is found in the workspace',
157
+ name: '--workspace',
158
+ },
159
+ {
160
+ description: 'Save the dependency to configurational dependencies',
161
+ name: '--config',
162
+ },
163
+ OPTIONS.ignoreScripts,
164
+ OPTIONS.offline,
165
+ OPTIONS.preferOffline,
166
+ OPTIONS.storeDir,
167
+ OPTIONS.virtualStoreDir,
168
+ OPTIONS.globalDir,
169
+ ...UNIVERSAL_OPTIONS,
170
+ {
171
+ description: 'A list of package names that are allowed to run postinstall scripts during installation',
172
+ name: '--allow-build',
173
+ },
174
+ ],
175
+ },
176
+ FILTERING,
177
+ ],
178
+ url: docsUrl('add'),
179
+ usages: [
180
+ 'pnpm add <name>',
181
+ 'pnpm add <name>@<tag>',
182
+ 'pnpm add <name>@<version>',
183
+ 'pnpm add <name>@<version range>',
184
+ 'pnpm add <git host>:<git user>/<repo name>',
185
+ 'pnpm add <git repo url>',
186
+ 'pnpm add <tarball file>',
187
+ 'pnpm add <tarball url>',
188
+ 'pnpm add <dir>',
189
+ ],
190
+ });
191
+ }
192
+ export async function handler(opts, params) {
193
+ if (opts.cliOptions['save'] === false) {
194
+ throw new PnpmError('OPTION_NOT_SUPPORTED', 'The "add" command currently does not support the no-save option');
195
+ }
196
+ if (!params || (params.length === 0)) {
197
+ throw new PnpmError('MISSING_PACKAGE_NAME', '`pnpm add` requires the package name');
198
+ }
199
+ if (opts.config) {
200
+ const store = await createStoreController(opts);
201
+ await resolveConfigDeps(params, {
202
+ ...opts,
203
+ store: store.ctrl,
204
+ storeDir: store.dir,
205
+ rootDir: opts.workspaceDir ?? opts.rootProjectManifestDir,
206
+ });
207
+ return;
208
+ }
209
+ if (!opts.recursive &&
210
+ opts.workspaceDir === opts.dir &&
211
+ !opts.ignoreWorkspaceRootCheck &&
212
+ !opts.workspaceRoot &&
213
+ opts.workspacePackagePatterns &&
214
+ opts.workspacePackagePatterns.length > 1) {
215
+ throw new PnpmError('ADDING_TO_ROOT', 'Running this command will add the dependency to the workspace root, ' +
216
+ 'which might not be what you want - if you really meant it, ' +
217
+ 'make it explicit by running this command again with the -w flag (or --workspace-root). ' +
218
+ 'If you don\'t want to see this warning anymore, you may set the ignore-workspace-root-check setting to true.');
219
+ }
220
+ if (opts.global) {
221
+ if (!opts.bin) {
222
+ throw new PnpmError('NO_GLOBAL_BIN_DIR', 'Unable to find the global bin directory', {
223
+ hint: 'Run "pnpm setup" to create it automatically, or set the global-bin-dir setting, or the PNPM_HOME env variable. The global bin directory should be in the PATH.',
224
+ });
225
+ }
226
+ if (params.includes('pnpm') || params.includes('@pnpm/exe')) {
227
+ throw new PnpmError('GLOBAL_PNPM_INSTALL', 'Use the "pnpm self-update" command to install or update pnpm');
228
+ }
229
+ return handleGlobalAdd(opts, params);
230
+ }
231
+ const include = {
232
+ dependencies: opts.production !== false,
233
+ devDependencies: opts.dev !== false,
234
+ optionalDependencies: opts.optional !== false,
235
+ };
236
+ if (opts.allowBuild?.length) {
237
+ if (opts.argv.original.includes('--allow-build')) {
238
+ throw new PnpmError('ALLOW_BUILD_MISSING_PACKAGE', 'The --allow-build flag is missing a package name. Please specify the package name(s) that are allowed to run installation scripts.');
239
+ }
240
+ if (opts.allowBuilds) {
241
+ const disallowedBuilds = Object.entries(opts.allowBuilds)
242
+ .filter(([, value]) => value === false)
243
+ .map(([pkg]) => pkg);
244
+ const overlapDependencies = disallowedBuilds.filter((dep) => opts.allowBuild?.includes(dep));
245
+ if (overlapDependencies.length) {
246
+ throw new PnpmError('OVERRIDING_IGNORED_BUILT_DEPENDENCIES', `The following dependencies are ignored by the root project, but are allowed to be built by the current command: ${overlapDependencies.join(', ')}`, {
247
+ hint: 'If you are sure you want to allow those dependencies to run installation scripts, remove them from the allowBuilds list (or change their value to true).',
248
+ });
249
+ }
250
+ }
251
+ const allowBuilds = {};
252
+ for (const pkg of opts.allowBuild) {
253
+ allowBuilds[pkg] = true;
254
+ }
255
+ if (opts.rootProjectManifestDir) {
256
+ opts.rootProjectManifest = opts.rootProjectManifest ?? {};
257
+ await writeSettings({
258
+ ...opts,
259
+ workspaceDir: opts.workspaceDir ?? opts.rootProjectManifestDir,
260
+ updatedSettings: {
261
+ allowBuilds,
262
+ },
263
+ });
264
+ }
265
+ // Pass the allowed packages to allowBuilds so they can build during this install
266
+ const mergedAllowBuilds = { ...opts.allowBuilds };
267
+ for (const pkg of opts.allowBuild) {
268
+ mergedAllowBuilds[pkg] = true;
269
+ }
270
+ return installDeps({
271
+ ...opts,
272
+ allowBuilds: mergedAllowBuilds,
273
+ fetchFullMetadata: getFetchFullMetadata(opts),
274
+ include,
275
+ includeDirect: include,
276
+ }, params);
277
+ }
278
+ return installDeps({
279
+ ...opts,
280
+ fetchFullMetadata: getFetchFullMetadata(opts),
281
+ include,
282
+ includeDirect: include,
283
+ }, params);
284
+ }
285
+ //# sourceMappingURL=add.js.map
package/lib/ci.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export declare const rcOptionsTypes: () => Record<string, unknown>;
2
+ export declare const cliOptionsTypes: () => Record<string, unknown>;
3
+ export declare const shorthands: Record<string, string>;
4
+ export declare const commandNames: string[];
5
+ export declare function help(): string;
6
+ export declare function handler(_opts: unknown): Promise<never>;
package/lib/ci.js ADDED
@@ -0,0 +1,20 @@
1
+ import { docsUrl } from '@pnpm/cli.utils';
2
+ import { PnpmError } from '@pnpm/error';
3
+ import { renderHelp } from 'render-help';
4
+ export const rcOptionsTypes = () => ({});
5
+ export const cliOptionsTypes = () => ({});
6
+ export const shorthands = {};
7
+ export const commandNames = ['ci', 'clean-install', 'ic', 'install-clean'];
8
+ export function help() {
9
+ return renderHelp({
10
+ aliases: ['clean-install', 'ic', 'install-clean'],
11
+ description: 'Clean install a project',
12
+ descriptionLists: [],
13
+ url: docsUrl('ci'),
14
+ usages: ['pnpm ci'],
15
+ });
16
+ }
17
+ export async function handler(_opts) {
18
+ throw new PnpmError('CI_NOT_IMPLEMENTED', 'The ci command is not implemented yet');
19
+ }
20
+ //# sourceMappingURL=ci.js.map
@@ -0,0 +1,2 @@
1
+ import { type WriteProjectManifest } from '@pnpm/workspace.project-manifest-reader';
2
+ export declare function createProjectManifestWriter(projectDir: string): Promise<WriteProjectManifest>;
@@ -0,0 +1,17 @@
1
+ import path from 'node:path';
2
+ import util from 'node:util';
3
+ import { readProjectManifest } from '@pnpm/workspace.project-manifest-reader';
4
+ import { writeProjectManifest } from '@pnpm/workspace.project-manifest-writer';
5
+ export async function createProjectManifestWriter(projectDir) {
6
+ try {
7
+ const { writeProjectManifest } = await readProjectManifest(projectDir);
8
+ return writeProjectManifest;
9
+ }
10
+ catch (err) {
11
+ if (util.types.isNativeError(err) && 'code' in err && err.code === 'ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND') {
12
+ return writeProjectManifest.bind(null, path.join(projectDir, 'package.json'));
13
+ }
14
+ throw err;
15
+ }
16
+ }
17
+ //# sourceMappingURL=createProjectManifestWriter.js.map
@@ -0,0 +1,9 @@
1
+ import { type InstallCommandOptions } from './install.js';
2
+ export declare function rcOptionsTypes(): Record<string, unknown>;
3
+ export declare function cliOptionsTypes(): Record<string, unknown>;
4
+ export declare const commandNames: string[];
5
+ export declare function help(): string;
6
+ export interface DedupeCommandOptions extends InstallCommandOptions {
7
+ readonly check?: boolean;
8
+ }
9
+ export declare function handler(opts: DedupeCommandOptions): Promise<void>;
package/lib/dedupe.js ADDED
@@ -0,0 +1,59 @@
1
+ import { OPTIONS, UNIVERSAL_OPTIONS } from '@pnpm/cli.common-cli-options-help';
2
+ import { docsUrl } from '@pnpm/cli.utils';
3
+ import { dedupeDiffCheck } from '@pnpm/installing.dedupe.check';
4
+ import { omit } from 'ramda';
5
+ import { renderHelp } from 'render-help';
6
+ import { rcOptionsTypes as installCommandRcOptionsTypes } from './install.js';
7
+ import { installDeps } from './installDeps.js';
8
+ // In general, the "pnpm dedupe" command should use .npmrc options that "pnpm install" would also accept.
9
+ export function rcOptionsTypes() {
10
+ // Some options on pnpm install (like --frozen-lockfile) don't make sense on pnpm dedupe.
11
+ return omit(['frozen-lockfile'], installCommandRcOptionsTypes());
12
+ }
13
+ export function cliOptionsTypes() {
14
+ return {
15
+ ...rcOptionsTypes(),
16
+ check: Boolean,
17
+ };
18
+ }
19
+ export const commandNames = ['dedupe'];
20
+ export function help() {
21
+ return renderHelp({
22
+ description: 'Perform an install removing older dependencies in the lockfile if a newer version can be used.',
23
+ descriptionLists: [
24
+ {
25
+ title: 'Options',
26
+ list: [
27
+ ...UNIVERSAL_OPTIONS,
28
+ {
29
+ description: 'Check if running dedupe would result in changes without installing packages or editing the lockfile. Exits with a non-zero status code if changes are possible.',
30
+ name: '--check',
31
+ },
32
+ OPTIONS.ignoreScripts,
33
+ OPTIONS.offline,
34
+ OPTIONS.preferOffline,
35
+ OPTIONS.storeDir,
36
+ OPTIONS.virtualStoreDir,
37
+ OPTIONS.globalDir,
38
+ ],
39
+ },
40
+ ],
41
+ url: docsUrl('dedupe'),
42
+ usages: ['pnpm dedupe'],
43
+ });
44
+ }
45
+ export async function handler(opts) {
46
+ const include = {
47
+ dependencies: opts.production !== false,
48
+ devDependencies: opts.dev !== false,
49
+ optionalDependencies: opts.optional !== false,
50
+ };
51
+ return installDeps({
52
+ ...opts,
53
+ dedupe: true,
54
+ include,
55
+ includeDirect: include,
56
+ lockfileCheck: opts.check ? dedupeDiffCheck : undefined,
57
+ }, []);
58
+ }
59
+ //# sourceMappingURL=dedupe.js.map
package/lib/fetch.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import type { Config } from '@pnpm/config.reader';
2
+ import { type CreateStoreControllerOptions } from '@pnpm/store.connection-manager';
3
+ import { cliOptionsTypes } from './install.js';
4
+ export declare const rcOptionsTypes: () => Record<string, unknown>;
5
+ export { cliOptionsTypes };
6
+ export declare const shorthands: Record<string, string>;
7
+ export declare const commandNames: string[];
8
+ export declare function help(): string;
9
+ type FetchCommandOptions = Pick<Config, 'production' | 'dev' | 'enableGlobalVirtualStore' | 'rootProjectManifest' | 'rootProjectManifestDir'> & CreateStoreControllerOptions;
10
+ export declare function handler(opts: FetchCommandOptions): Promise<void>;
package/lib/fetch.js ADDED
@@ -0,0 +1,75 @@
1
+ import { UNIVERSAL_OPTIONS } from '@pnpm/cli.common-cli-options-help';
2
+ import { docsUrl } from '@pnpm/cli.utils';
3
+ import { mutateModulesInSingleProject } from '@pnpm/installing.deps-installer';
4
+ import { createStoreController } from '@pnpm/store.connection-manager';
5
+ import { renderHelp } from 'render-help';
6
+ import { cliOptionsTypes } from './install.js';
7
+ export const rcOptionsTypes = cliOptionsTypes;
8
+ export { cliOptionsTypes };
9
+ export const shorthands = {
10
+ D: '--dev',
11
+ P: '--production',
12
+ };
13
+ export const commandNames = ['fetch'];
14
+ export function help() {
15
+ return renderHelp({
16
+ description: 'Fetch packages from a lockfile into virtual store, package manifest is ignored. WARNING! This is an experimental command. Breaking changes may be introduced in non-major versions of the CLI',
17
+ descriptionLists: [
18
+ {
19
+ title: 'Options',
20
+ list: [
21
+ {
22
+ description: 'Only development packages will be fetched',
23
+ name: '--dev',
24
+ shortAlias: '-D',
25
+ },
26
+ {
27
+ description: 'Development packages will not be fetched',
28
+ name: '--prod',
29
+ shortAlias: '-P',
30
+ },
31
+ ...UNIVERSAL_OPTIONS,
32
+ ],
33
+ },
34
+ ],
35
+ url: docsUrl('fetch'),
36
+ usages: ['pnpm fetch [--dev | --prod]'],
37
+ });
38
+ }
39
+ export async function handler(opts) {
40
+ const store = await createStoreController(opts);
41
+ const include = {
42
+ dependencies: opts.production !== false,
43
+ devDependencies: opts.dev !== false,
44
+ // when including optional deps, production is also required when perform headless install
45
+ optionalDependencies: opts.production !== false,
46
+ };
47
+ await mutateModulesInSingleProject({
48
+ manifest: {},
49
+ mutation: 'install',
50
+ pruneDirectDependencies: true,
51
+ rootDir: process.cwd(),
52
+ }, {
53
+ ...opts,
54
+ ignorePackageManifest: true,
55
+ ignoreLocalPackages: true,
56
+ include,
57
+ modulesCacheMaxAge: 0,
58
+ pruneStore: true,
59
+ storeController: store.ctrl,
60
+ storeDir: store.dir,
61
+ // Hoisting is skipped anyway,
62
+ // so we store these empty patterns in node_modules/.modules.yaml
63
+ // to let the subsequent install know that hoisting should be performed.
64
+ hoistPattern: [],
65
+ publicHoistPattern: [],
66
+ // virtualStoreOnly skips post-import linking (symlinks, bins, hoisting)
67
+ // even if ignorePackageManifest handling changes in the future.
68
+ virtualStoreOnly: true,
69
+ // Ensure fetch can populate the virtual store even when the user has
70
+ // enable-modules-dir=false in their config — fetch always needs node_modules/.pnpm
71
+ // (unless GVS is active, in which case enableModulesDir doesn't matter).
72
+ enableModulesDir: true,
73
+ });
74
+ }
75
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1,8 @@
1
+ import type { InstallCommandOptions } from './install.js';
2
+ export type GetFetchFullMetadataOptions = Pick<InstallCommandOptions, 'supportedArchitectures'>;
3
+ /**
4
+ * This function is a workaround for the fact that npm registry's abbreviated metadata currently does not contain `libc`.
5
+ *
6
+ * See <https://github.com/pnpm/pnpm/issues/7362#issuecomment-1971964689>.
7
+ */
8
+ export declare const getFetchFullMetadata: (opts: GetFetchFullMetadataOptions) => true | undefined;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This function is a workaround for the fact that npm registry's abbreviated metadata currently does not contain `libc`.
3
+ *
4
+ * See <https://github.com/pnpm/pnpm/issues/7362#issuecomment-1971964689>.
5
+ */
6
+ export const getFetchFullMetadata = (opts) => opts.supportedArchitectures?.libc && true;
7
+ //# sourceMappingURL=getFetchFullMetadata.js.map
@@ -0,0 +1,4 @@
1
+ export declare function getPinnedVersion(opts: {
2
+ saveExact?: boolean;
3
+ savePrefix?: string;
4
+ }): 'major' | 'minor' | 'patch';
@@ -0,0 +1,6 @@
1
+ export function getPinnedVersion(opts) {
2
+ if (opts.saveExact === true || opts.savePrefix === '')
3
+ return 'patch';
4
+ return opts.savePrefix === '~' ? 'minor' : 'major';
5
+ }
6
+ //# sourceMappingURL=getPinnedVersion.js.map
@@ -0,0 +1,3 @@
1
+ import type { Config } from '@pnpm/config.reader';
2
+ import type { DependenciesField } from '@pnpm/types';
3
+ export declare function getSaveType(opts: Pick<Config, 'saveDev' | 'saveOptional' | 'saveProd' | 'savePeer'>): DependenciesField | undefined;
@@ -0,0 +1,10 @@
1
+ export function getSaveType(opts) {
2
+ if (opts.saveDev === true || opts.savePeer)
3
+ return 'devDependencies';
4
+ if (opts.saveOptional)
5
+ return 'optionalDependencies';
6
+ if (opts.saveProd)
7
+ return 'dependencies';
8
+ return undefined;
9
+ }
10
+ //# sourceMappingURL=getSaveType.js.map
@@ -0,0 +1,9 @@
1
+ import type { Config } from '@pnpm/config.reader';
2
+ import { type InstallOptions } from '@pnpm/installing.deps-installer';
3
+ import { type CreateStoreControllerOptions } from '@pnpm/store.connection-manager';
4
+ export declare const rcOptionsTypes: typeof cliOptionsTypes;
5
+ export declare function cliOptionsTypes(): Record<string, unknown>;
6
+ export declare function help(): string;
7
+ export declare const commandNames: string[];
8
+ export type ImportCommandOptions = Pick<Config, 'allProjects' | 'allProjectsGraph' | 'selectedProjectsGraph' | 'workspaceDir' | 'ignoreWorkspaceCycles' | 'disallowWorkspaceCycles' | 'sharedWorkspaceLockfile' | 'workspacePackagePatterns' | 'rootProjectManifest' | 'rootProjectManifestDir'> & CreateStoreControllerOptions & Omit<InstallOptions, 'storeController' | 'lockfileOnly' | 'preferredVersions'>;
9
+ export declare function handler(opts: ImportCommandOptions, params: string[]): Promise<void>;