@pnpm/plugin-commands-listing 1000.2.13 → 1000.3.1

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.
@@ -0,0 +1,26 @@
1
+ import { type Finder, type IncludedDependencies } from '@pnpm/types';
2
+ export type ReportAs = 'parseable' | 'json' | 'tree';
3
+ export declare function computeInclude(opts: {
4
+ production?: boolean;
5
+ dev?: boolean;
6
+ optional?: boolean;
7
+ }): IncludedDependencies;
8
+ export declare function resolveFinders(opts: {
9
+ findBy?: string[];
10
+ finders?: Record<string, Finder>;
11
+ }): Finder[];
12
+ export declare function determineReportAs(opts: {
13
+ parseable?: boolean;
14
+ json?: boolean;
15
+ }): ReportAs;
16
+ export declare const shorthands: Record<string, string>;
17
+ export declare const BASE_RC_OPTION_KEYS: readonly ["dev", "global-dir", "global", "json", "long", "only", "optional", "parseable", "production"];
18
+ export declare const SHARED_CLI_HELP_OPTIONS: ({
19
+ description: string;
20
+ name: string;
21
+ shortAlias: string;
22
+ } | {
23
+ description: string;
24
+ name: string;
25
+ shortAlias?: undefined;
26
+ })[];
package/lib/common.js ADDED
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SHARED_CLI_HELP_OPTIONS = exports.BASE_RC_OPTION_KEYS = exports.shorthands = void 0;
4
+ exports.computeInclude = computeInclude;
5
+ exports.resolveFinders = resolveFinders;
6
+ exports.determineReportAs = determineReportAs;
7
+ const error_1 = require("@pnpm/error");
8
+ function computeInclude(opts) {
9
+ return {
10
+ dependencies: opts.production !== false,
11
+ devDependencies: opts.dev !== false,
12
+ optionalDependencies: opts.optional !== false,
13
+ };
14
+ }
15
+ function resolveFinders(opts) {
16
+ const finders = [];
17
+ if (opts.findBy) {
18
+ for (const finderName of opts.findBy) {
19
+ if (opts.finders?.[finderName] == null) {
20
+ throw new error_1.PnpmError('FINDER_NOT_FOUND', `No finder with name ${finderName} is found`);
21
+ }
22
+ finders.push(opts.finders[finderName]);
23
+ }
24
+ }
25
+ return finders;
26
+ }
27
+ function determineReportAs(opts) {
28
+ return opts.parseable ? 'parseable' : (opts.json ? 'json' : 'tree');
29
+ }
30
+ exports.shorthands = {
31
+ D: '--dev',
32
+ P: '--production',
33
+ };
34
+ exports.BASE_RC_OPTION_KEYS = [
35
+ 'dev',
36
+ 'global-dir',
37
+ 'global',
38
+ 'json',
39
+ 'long',
40
+ 'only',
41
+ 'optional',
42
+ 'parseable',
43
+ 'production',
44
+ ];
45
+ exports.SHARED_CLI_HELP_OPTIONS = [
46
+ {
47
+ description: 'Perform command on every package in subdirectories \
48
+ or on every workspace package, when executed inside a workspace. \
49
+ For options that may be used with `-r`, see "pnpm help recursive"',
50
+ name: '--recursive',
51
+ shortAlias: '-r',
52
+ },
53
+ {
54
+ description: 'Show extended information',
55
+ name: '--long',
56
+ },
57
+ {
58
+ description: 'Show parseable output instead of tree view',
59
+ name: '--parseable',
60
+ },
61
+ {
62
+ description: 'Show information in JSON format',
63
+ name: '--json',
64
+ },
65
+ {
66
+ description: 'List packages in the global install prefix instead of in the current project',
67
+ name: '--global',
68
+ shortAlias: '-g',
69
+ },
70
+ {
71
+ description: 'Display only the dependency graph for packages in `dependencies` and `optionalDependencies`',
72
+ name: '--prod',
73
+ shortAlias: '-P',
74
+ },
75
+ {
76
+ description: 'Display only the dependency graph for packages in `devDependencies`',
77
+ name: '--dev',
78
+ shortAlias: '-D',
79
+ },
80
+ {
81
+ description: "Don't display packages from `optionalDependencies`",
82
+ name: '--no-optional',
83
+ },
84
+ ];
85
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":";;;AAKA,wCAMC;AAED,wCAWC;AAED,8CAEC;AA5BD,uCAAuC;AAKvC,SAAgB,cAAc,CAAE,IAAiE;IAC/F,OAAO;QACL,YAAY,EAAE,IAAI,CAAC,UAAU,KAAK,KAAK;QACv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D,IAAI,EAAE,aAAa;KACpB;IACD;QACE,WAAW,EAAE,iCAAiC;QAC9C,IAAI,EAAE,QAAQ;KACf;IACD;QACE,WAAW,EAAE,8EAA8E;QAC3F,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,IAAI;KACjB;IACD;QACE,WAAW,EAAE,6FAA6F;QAC1G,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,IAAI;KACjB;IACD;QACE,WAAW,EAAE,qEAAqE;QAClF,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,IAAI;KACjB;IACD;QACE,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,eAAe;KACtB;CACF,CAAA"}
package/lib/list.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare const EXCLUDE_PEERS_HELP: {
6
6
  };
7
7
  export declare function rcOptionsTypes(): Record<string, unknown>;
8
8
  export declare const cliOptionsTypes: () => Record<string, unknown>;
9
- export declare const shorthands: Record<string, string>;
9
+ export { shorthands } from './common.js';
10
10
  export declare const commandNames: string[];
11
11
  export declare function help(): string;
12
12
  export type ListCommandOptions = Pick<Config, 'allProjects' | 'dev' | 'dir' | 'finders' | 'optional' | 'production' | 'selectedProjectsGraph' | 'modulesDir' | 'virtualStoreDirMaxLength'> & Partial<Pick<Config, 'cliOptions'>> & {
package/lib/list.js CHANGED
@@ -8,13 +8,13 @@ exports.rcOptionsTypes = rcOptionsTypes;
8
8
  exports.help = help;
9
9
  exports.handler = handler;
10
10
  exports.render = render;
11
- const error_1 = require("@pnpm/error");
12
11
  const cli_utils_1 = require("@pnpm/cli-utils");
13
12
  const common_cli_options_help_1 = require("@pnpm/common-cli-options-help");
14
13
  const config_1 = require("@pnpm/config");
15
14
  const list_1 = require("@pnpm/list");
16
15
  const pick_1 = __importDefault(require("ramda/src/pick"));
17
16
  const render_help_1 = __importDefault(require("render-help"));
17
+ const common_js_1 = require("./common.js");
18
18
  const recursive_js_1 = require("./recursive.js");
19
19
  exports.EXCLUDE_PEERS_HELP = {
20
20
  description: 'Exclude peer dependencies',
@@ -22,17 +22,9 @@ exports.EXCLUDE_PEERS_HELP = {
22
22
  };
23
23
  function rcOptionsTypes() {
24
24
  return (0, pick_1.default)([
25
+ ...common_js_1.BASE_RC_OPTION_KEYS,
25
26
  'depth',
26
- 'dev',
27
- 'global-dir',
28
- 'global',
29
- 'json',
30
27
  'lockfile-only',
31
- 'long',
32
- 'only',
33
- 'optional',
34
- 'parseable',
35
- 'production',
36
28
  ], config_1.types);
37
29
  }
38
30
  const cliOptionsTypes = () => ({
@@ -43,10 +35,8 @@ const cliOptionsTypes = () => ({
43
35
  'find-by': [String, Array],
44
36
  });
45
37
  exports.cliOptionsTypes = cliOptionsTypes;
46
- exports.shorthands = {
47
- D: '--dev',
48
- P: '--production',
49
- };
38
+ var common_js_2 = require("./common.js");
39
+ Object.defineProperty(exports, "shorthands", { enumerable: true, get: function () { return common_js_2.shorthands; } });
50
40
  exports.commandNames = ['list', 'ls'];
51
41
  function help() {
52
42
  return (0, render_help_1.default)({
@@ -58,30 +48,7 @@ For example: pnpm ls babel-* eslint-*',
58
48
  {
59
49
  title: 'Options',
60
50
  list: [
61
- {
62
- description: 'Perform command on every package in subdirectories \
63
- or on every workspace package, when executed inside a workspace. \
64
- For options that may be used with `-r`, see "pnpm help recursive"',
65
- name: '--recursive',
66
- shortAlias: '-r',
67
- },
68
- {
69
- description: 'Show extended information',
70
- name: '--long',
71
- },
72
- {
73
- description: 'Show parseable output instead of tree view',
74
- name: '--parseable',
75
- },
76
- {
77
- description: 'Show information in JSON format',
78
- name: '--json',
79
- },
80
- {
81
- description: 'List packages in the global install prefix instead of in the current project',
82
- name: '--global',
83
- shortAlias: '-g',
84
- },
51
+ ...common_js_1.SHARED_CLI_HELP_OPTIONS,
85
52
  {
86
53
  description: 'Max display depth of the dependency tree',
87
54
  name: '--depth <number>',
@@ -94,24 +61,10 @@ For options that may be used with `-r`, see "pnpm help recursive"',
94
61
  description: 'Display only projects. Useful in a monorepo. `pnpm ls -r --depth -1` lists all projects in a monorepo',
95
62
  name: '--depth -1',
96
63
  },
97
- {
98
- description: 'Display only the dependency graph for packages in `dependencies` and `optionalDependencies`',
99
- name: '--prod',
100
- shortAlias: '-P',
101
- },
102
- {
103
- description: 'Display only the dependency graph for packages in `devDependencies`',
104
- name: '--dev',
105
- shortAlias: '-D',
106
- },
107
64
  {
108
65
  description: 'Display only dependencies that are also projects within the workspace',
109
66
  name: '--only-projects',
110
67
  },
111
- {
112
- description: "Don't display packages from `optionalDependencies`",
113
- name: '--no-optional',
114
- },
115
68
  {
116
69
  description: 'List packages from the lockfile only, without checking node_modules.',
117
70
  name: '--lockfile-only',
@@ -130,11 +83,7 @@ For options that may be used with `-r`, see "pnpm help recursive"',
130
83
  });
131
84
  }
132
85
  async function handler(opts, params) {
133
- const include = {
134
- dependencies: opts.production !== false,
135
- devDependencies: opts.dev !== false,
136
- optionalDependencies: opts.optional !== false,
137
- };
86
+ const include = (0, common_js_1.computeInclude)(opts);
138
87
  const depth = opts.cliOptions?.['depth'] ?? 0;
139
88
  if (opts.recursive && (opts.selectedProjectsGraph != null)) {
140
89
  const pkgs = Object.values(opts.selectedProjectsGraph).map((wsPkg) => wsPkg.package);
@@ -149,15 +98,7 @@ async function handler(opts, params) {
149
98
  });
150
99
  }
151
100
  async function render(prefixes, params, opts) {
152
- const finders = [];
153
- if (opts.findBy) {
154
- for (const finderName of opts.findBy) {
155
- if (opts.finders?.[finderName] == null) {
156
- throw new error_1.PnpmError('FINDER_NOT_FOUND', `No finder with name ${finderName} is found`);
157
- }
158
- finders.push(opts.finders[finderName]);
159
- }
160
- }
101
+ const finders = (0, common_js_1.resolveFinders)(opts);
161
102
  const listOpts = {
162
103
  alwaysPrintRootPackage: opts.alwaysPrintRootPackage,
163
104
  depth: opts.depth ?? 0,
@@ -167,8 +108,9 @@ async function render(prefixes, params, opts) {
167
108
  checkWantedLockfileOnly: opts.checkWantedLockfileOnly,
168
109
  long: opts.long,
169
110
  onlyProjects: opts.onlyProjects,
170
- reportAs: (opts.parseable ? 'parseable' : (opts.json ? 'json' : 'tree')),
111
+ reportAs: (0, common_js_1.determineReportAs)(opts),
171
112
  showExtraneous: false,
113
+ showSummary: true,
172
114
  modulesDir: opts.modulesDir,
173
115
  virtualStoreDirMaxLength: opts.virtualStoreDirMaxLength,
174
116
  finders,
package/lib/list.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":";;;;;;AAeA,wCAcC;AAiBD,oBAiFC;AA0BD,0BAqBC;AAED,wBA+CC;AA/ND,uCAAuC;AACvC,+CAAyC;AACzC,2EAAqF;AACrF,yCAA6D;AAC7D,qCAAkD;AAElD,0DAAiC;AACjC,8DAAoC;AACpC,iDAA8C;AAEjC,QAAA,kBAAkB,GAAG;IAChC,WAAW,EAAE,2BAA2B;IACxC,IAAI,EAAE,iBAAiB;CACxB,CAAA;AAED,SAAgB,cAAc;IAC5B,OAAO,IAAA,cAAI,EAAC;QACV,OAAO;QACP,KAAK;QACL,YAAY;QACZ,QAAQ;QACR,MAAM;QACN,eAAe;QACf,MAAM;QACN,MAAM;QACN,UAAU;QACV,WAAW;QACX,YAAY;KACb,EAAE,cAAQ,CAAC,CAAA;AACd,CAAC;AAEM,MAAM,eAAe,GAAG,GAA4B,EAAE,CAAC,CAAC;IAC7D,GAAG,cAAc,EAAE;IACnB,eAAe,EAAE,OAAO;IACxB,eAAe,EAAE,OAAO;IACxB,SAAS,EAAE,OAAO;IAClB,SAAS,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;CAC3B,CAAC,CAAA;AANW,QAAA,eAAe,mBAM1B;AAEW,QAAA,UAAU,GAA2B;IAChD,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,cAAc;CAClB,CAAA;AAEY,QAAA,YAAY,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAE1C,SAAgB,IAAI;IAClB,OAAO,IAAA,qBAAU,EAAC;QAChB,OAA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AClB,MAAgB,EAChB,IAeC;IAED,MAAM,OAAO,GAAG,IAAA,0BAAc,EAAC,IAAI,CAAC,CAAA;IACpC,MAAM,QAAQ,GAAG;QACf,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;QACnD,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC;QACtB,uBAAuB,EAAE,IAAI,CAAC,YAAY;QAC1C,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;QACrD,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,QAAQ,EAAE,IAAA,6BAAiB,EAAC,IAAI,CAAC;QACjC,cAAc,EAAE,KAAK;QACrB,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;QACvD,OAAO;KACR,CAAA;IACD,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QACvD,CAAC,CAAC,IAAA,sBAAe,EAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC;QAC7C,CAAC,CAAC,IAAA,WAAI,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAC9B,CAAC"}
package/lib/why.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type ListCommandOptions } from './list.js';
2
2
  export declare function rcOptionsTypes(): Record<string, unknown>;
3
3
  export declare const cliOptionsTypes: () => Record<string, unknown>;
4
- export declare const shorthands: Record<string, string>;
4
+ export { shorthands } from './common.js';
5
5
  export declare const commandNames: string[];
6
6
  export declare function help(): string;
7
7
  export declare function handler(opts: ListCommandOptions, params: string[]): Promise<string>;
package/lib/why.js CHANGED
@@ -11,22 +11,13 @@ const cli_utils_1 = require("@pnpm/cli-utils");
11
11
  const common_cli_options_help_1 = require("@pnpm/common-cli-options-help");
12
12
  const config_1 = require("@pnpm/config");
13
13
  const error_1 = require("@pnpm/error");
14
+ const list_1 = require("@pnpm/list");
14
15
  const pick_1 = __importDefault(require("ramda/src/pick"));
15
16
  const render_help_1 = __importDefault(require("render-help"));
17
+ const common_js_1 = require("./common.js");
16
18
  const list_js_1 = require("./list.js");
17
19
  function rcOptionsTypes() {
18
- return (0, pick_1.default)([
19
- 'depth',
20
- 'dev',
21
- 'global-dir',
22
- 'global',
23
- 'json',
24
- 'long',
25
- 'only',
26
- 'optional',
27
- 'parseable',
28
- 'production',
29
- ], config_1.types);
20
+ return (0, pick_1.default)([...common_js_1.BASE_RC_OPTION_KEYS, 'depth'], config_1.types);
30
21
  }
31
22
  const cliOptionsTypes = () => ({
32
23
  ...rcOptionsTypes(),
@@ -35,10 +26,8 @@ const cliOptionsTypes = () => ({
35
26
  'find-by': [String, Array],
36
27
  });
37
28
  exports.cliOptionsTypes = cliOptionsTypes;
38
- exports.shorthands = {
39
- D: '--dev',
40
- P: '--production',
41
- };
29
+ var common_js_2 = require("./common.js");
30
+ Object.defineProperty(exports, "shorthands", { enumerable: true, get: function () { return common_js_2.shorthands; } });
42
31
  exports.commandNames = ['why'];
43
32
  function help() {
44
33
  return (0, render_help_1.default)({
@@ -48,47 +37,10 @@ For example: pnpm why babel-* eslint-*`,
48
37
  {
49
38
  title: 'Options',
50
39
  list: [
40
+ ...common_js_1.SHARED_CLI_HELP_OPTIONS,
51
41
  {
52
- description: 'Perform command on every package in subdirectories \
53
- or on every workspace package, when executed inside a workspace. \
54
- For options that may be used with `-r`, see "pnpm help recursive"',
55
- name: '--recursive',
56
- shortAlias: '-r',
57
- },
58
- {
59
- description: 'Show extended information',
60
- name: '--long',
61
- },
62
- {
63
- description: 'Show parseable output instead of tree view',
64
- name: '--parseable',
65
- },
66
- {
67
- description: 'Show information in JSON format',
68
- name: '--json',
69
- },
70
- {
71
- description: 'List packages in the global install prefix instead of in the current project',
72
- name: '--global',
73
- shortAlias: '-g',
74
- },
75
- {
76
- description: 'Display only the dependency graph for packages in `dependencies` and `optionalDependencies`',
77
- name: '--prod',
78
- shortAlias: '-P',
79
- },
80
- {
81
- description: 'Display only the dependency graph for packages in `devDependencies`',
82
- name: '--dev',
83
- shortAlias: '-D',
84
- },
85
- {
86
- description: "Don't display packages from `optionalDependencies`",
87
- name: '--no-optional',
88
- },
89
- {
42
+ description: 'Max display depth of the reverse dependency tree',
90
43
  name: '--depth <number>',
91
- description: 'Max display depth of the dependency graph',
92
44
  },
93
45
  list_js_1.EXCLUDE_PEERS_HELP,
94
46
  common_cli_options_help_1.OPTIONS.globalDir,
@@ -107,12 +59,23 @@ async function handler(opts, params) {
107
59
  if (params.length === 0 && opts.findBy == null) {
108
60
  throw new error_1.PnpmError('MISSING_PACKAGE_NAME', '`pnpm why` requires the package name or --find-by=<finder-name>');
109
61
  }
110
- return (0, list_js_1.handler)({
111
- ...opts,
112
- cliOptions: {
113
- ...(opts.cliOptions ?? {}),
114
- depth: opts.depth ?? Infinity,
115
- },
116
- }, params);
62
+ const include = (0, common_js_1.computeInclude)(opts);
63
+ const finders = (0, common_js_1.resolveFinders)(opts);
64
+ const lockfileDir = opts.lockfileDir ?? opts.dir;
65
+ const reportAs = (0, common_js_1.determineReportAs)(opts);
66
+ const depth = opts.cliOptions?.['depth'];
67
+ const projectPaths = opts.recursive && opts.selectedProjectsGraph
68
+ ? Object.keys(opts.selectedProjectsGraph)
69
+ : [opts.dir];
70
+ return (0, list_1.whyForPackages)(params, projectPaths, {
71
+ depth,
72
+ include,
73
+ long: opts.long,
74
+ lockfileDir,
75
+ reportAs,
76
+ modulesDir: opts.modulesDir,
77
+ checkWantedLockfileOnly: opts.lockfileOnly,
78
+ finders,
79
+ });
117
80
  }
118
81
  //# sourceMappingURL=why.js.map
package/lib/why.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"why.js","sourceRoot":"","sources":["../src/why.ts"],"names":[],"mapp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IAAI,IAAI,CAAC,GAAG,CAAA;IAChD,MAAM,QAAQ,GAAG,IAAA,6BAAiB,EAAC,IAAI,CAAC,CAAA;IACxC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,OAAO,CAAuB,CAAA;IAE9D,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,qBAAqB;QAC/D,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC;QACzC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAEd,OAAO,IAAA,qBAAc,EAAC,MAAM,EAAE,YAAY,EAAE;QAC1C,KAAK;QACL,OAAO;QACP,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW;QACX,QAAQ;QACR,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,uBAAuB,EAAE,IAAI,CAAC,YAAY;QAC1C,OAAO;KACR,CAAC,CAAA;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/plugin-commands-listing",
3
- "version": "1000.2.13",
3
+ "version": "1000.3.1",
4
4
  "description": "The list and why commands of pnpm",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -26,12 +26,12 @@
26
26
  "dependencies": {
27
27
  "ramda": "npm:@pnpm/ramda@0.28.1",
28
28
  "render-help": "^1.0.3",
29
- "@pnpm/cli-utils": "1001.3.4",
30
- "@pnpm/common-cli-options-help": "1000.0.1",
31
- "@pnpm/config": "1004.10.1",
29
+ "@pnpm/cli-utils": "1001.3.6",
30
+ "@pnpm/config": "1004.10.2",
31
+ "@pnpm/list": "1000.3.1",
32
+ "@pnpm/types": "1001.3.0",
32
33
  "@pnpm/error": "1000.0.5",
33
- "@pnpm/list": "1000.2.7",
34
- "@pnpm/types": "1001.3.0"
34
+ "@pnpm/common-cli-options-help": "1000.0.1"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@pnpm/logger": ">=1001.0.0 <1002.0.0"
@@ -41,13 +41,13 @@
41
41
  "@types/ramda": "0.29.12",
42
42
  "execa": "npm:safe-execa@0.1.2",
43
43
  "write-yaml-file": "^5.0.0",
44
- "@pnpm/constants": "1001.3.1",
45
- "@pnpm/filter-workspace-packages": "1000.1.0",
46
44
  "@pnpm/logger": "1001.0.1",
47
- "@pnpm/prepare": "1000.0.14",
48
- "@pnpm/plugin-commands-installation": "1004.9.6",
49
- "@pnpm/workspace.filter-packages-from-dir": "1000.0.59",
50
- "@pnpm/plugin-commands-listing": "1000.2.13"
45
+ "@pnpm/filter-workspace-packages": "1000.1.2",
46
+ "@pnpm/constants": "1001.3.1",
47
+ "@pnpm/plugin-commands-listing": "1000.3.1",
48
+ "@pnpm/workspace.filter-packages-from-dir": "1000.0.61",
49
+ "@pnpm/prepare": "1000.0.15",
50
+ "@pnpm/plugin-commands-installation": "1004.9.8"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=18.12"