@pnpm/config.commands 1100.1.0 → 1101.0.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @pnpm/plugin-commands-config
2
2
 
3
+ ## 1101.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - The three registry lookups are now named for what they are keyed by, so that none of them is called `registries` — a name the `registries` setting itself has taken:
8
+
9
+ | before | after |
10
+ |---|---|
11
+ | `Config.registries` | `Config.registriesByScope` |
12
+ | `Config.namedRegistries` | `Config.registriesByPrefix` |
13
+ | `Config.registryOptions` | `Config.registryOptionsByUrl` |
14
+
15
+ The same rename applies to the `RegistryContext` fields, the `Registries` and `NamedRegistries` types (now `RegistriesByScope` and `RegistriesByPrefix`), `normalizeRegistries` / `normalizeNamedRegistries` (now `normalizeRegistriesByScope` / `normalizeRegistriesByPrefix`), and the `BUILTIN_NAMED_REGISTRIES` constant (now `BUILTIN_REGISTRIES_BY_PREFIX`).
16
+
17
+ This is an internal rename: no setting, error code, lockfile field, or `.pnpmfile.cjs` hook field changes. A `preResolution` hook still reads `ctx.registries`, which is the name pacquet passes as well. The `registries` and `namedRegistries` settings are read under the names users write them.
18
+
19
+ The pnpr resolve request sends `registriesByPrefix` where it sent `namedRegistries`. A pnpr server and its clients must be on matching versions, which is already the case for an experimental server.
20
+
21
+ ### Minor Changes
22
+
23
+ - `pnpm config get` and `pnpm config list` now show the settings pnpm acts on under their documented names:
24
+
25
+ - `registries` shows the registries pnpm resolves from, merged across every source (`.npmrc`, `pnpm-workspace.yaml`, the global config, CLI flags), in the shape the setting is written in: keyed by registry URL, with the default registry declared as the bare `@` scope. Built-in routes are included — the `@jsr` scope and the `npmjs` and `gh` prefixes — unless pointed elsewhere. Previously `pnpm config get registries` printed `undefined`.
26
+ - `update` and `audit` show the effective sections, whichever spelling set them. The deprecated internal spellings (`updateConfig`, `auditConfig`, `auditLevel`) are no longer listed.
27
+ - `catalogs` shows the complete resolved catalog set — the singular `catalog` block is its `default` entry — whichever spelling declared it.
28
+ - The `registry` and `@scope:registry` entries show the merged routes rather than raw `.npmrc` values, so they always agree with the `registries` view.
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies:
33
+ - @pnpm/cli.utils@1101.0.24
34
+ - @pnpm/config.normalize-registries@1101.0.0
35
+ - @pnpm/config.reader@1102.0.0
36
+ - @pnpm/constants@1102.0.0
37
+ - @pnpm/error@1100.1.3
38
+ - @pnpm/object.property-path@1100.1.5
39
+ - @pnpm/workspace.workspace-manifest-writer@1100.1.1
40
+
3
41
  ## 1100.1.0
4
42
 
5
43
  ### Minor Changes
package/lib/configGet.js CHANGED
@@ -20,7 +20,7 @@ function lookupConfig(opts, key, isScopedKey) {
20
20
  // `pnpm publish` and the resolvers actually use.
21
21
  if (key.endsWith(':registry')) {
22
22
  const scope = key.slice(0, key.length - ':registry'.length);
23
- const merged = opts._config.registries?.[scope];
23
+ const merged = opts._config.registriesByScope?.[scope];
24
24
  if (merged !== undefined) {
25
25
  return { value: merged };
26
26
  }
@@ -31,6 +31,12 @@ function lookupConfig(opts, key, isScopedKey) {
31
31
  return { value: getGlobalConfigPath(opts.configDir) };
32
32
  }
33
33
  const kebabKey = isCamelCase(key) ? kebabCase(key) : key;
34
+ // The merged map is what resolvers use, so `registry` answers the same
35
+ // default the resolved `registries` view declares as the bare `@` scope —
36
+ // a raw `.npmrc` value would contradict it.
37
+ if (kebabKey === 'registry') {
38
+ return { value: opts._config.registriesByScope?.default ?? opts.authConfig.registry };
39
+ }
34
40
  // Resolve typed keys from Config — check explicitly set values first,
35
41
  // then fall back to authConfig (for keys like registry set in .npmrc)
36
42
  if (Object.hasOwn(types, kebabKey)) {
@@ -2,7 +2,9 @@ import { type Config } from '@pnpm/config.reader';
2
2
  /**
3
3
  * Convert a Config object to a camelCase record for display.
4
4
  * Only includes explicitly set values (from CLI, env vars, or workspace yaml),
5
- * not default values. Auth/registry keys from authConfig are always included.
5
+ * not default values. Auth/registry keys from authConfig are always included,
6
+ * and so is `registries` — the registries the CLI resolves from, merged
7
+ * across every source.
6
8
  *
7
9
  * Accepts a clean Config object (without ConfigContext fields mixed in),
8
10
  * so no INTERNAL_CONFIG_KEYS exclusion list is needed.
@@ -1,15 +1,24 @@
1
- import { types } from '@pnpm/config.reader';
1
+ import { pickRegistryContext, toResolvedRegistryDeclarations } from '@pnpm/config.normalize-registries';
2
+ import { toAuditSettings, toUpdateSettings, types } from '@pnpm/config.reader';
2
3
  import { sortDirectKeys } from '@pnpm/object.key-sorting';
3
4
  import camelcase from 'camelcase';
4
5
  import { censorProtectedSettings } from './protectedSettings.js';
5
- // Auth-related Config fields that are internal objects, not user settings.
6
+ // Config fields the record does not copy verbatim: internal objects, the
7
+ // lookups and spellings the `registries` / `update` / `audit` settings are
8
+ // split into (shown re-joined under the documented names instead), and
9
+ // `catalogs`, which is re-added below as the resolved catalog set.
6
10
  const NON_SETTING_CONFIG_KEYS = new Set([
7
11
  'authConfig', 'configByUri',
12
+ 'registriesByScope', 'registriesByPrefix', 'registryOptionsByUrl',
13
+ 'updateConfig', 'auditConfig', 'auditLevel',
14
+ 'catalogs',
8
15
  ]);
9
16
  /**
10
17
  * Convert a Config object to a camelCase record for display.
11
18
  * Only includes explicitly set values (from CLI, env vars, or workspace yaml),
12
- * not default values. Auth/registry keys from authConfig are always included.
19
+ * not default values. Auth/registry keys from authConfig are always included,
20
+ * and so is `registries` — the registries the CLI resolves from, merged
21
+ * across every source.
13
22
  *
14
23
  * Accepts a clean Config object (without ConfigContext fields mixed in),
15
24
  * so no INTERNAL_CONFIG_KEYS exclusion list is needed.
@@ -19,7 +28,7 @@ export function configToRecord(config, explicitlySetKeys) {
19
28
  // Add typed settings (only explicitly set ones if tracking is available)
20
29
  for (const kebabKey of Object.keys(types)) {
21
30
  const camelKey = camelcase(kebabKey, { locale: 'en-US' });
22
- if (!explicitlySetKeys.has(camelKey))
31
+ if (!explicitlySetKeys.has(camelKey) || NON_SETTING_CONFIG_KEYS.has(camelKey))
23
32
  continue;
24
33
  const value = config[camelKey];
25
34
  if (value !== undefined) {
@@ -40,10 +49,30 @@ export function configToRecord(config, explicitlySetKeys) {
40
49
  result[key] = value;
41
50
  }
42
51
  }
52
+ // The `registry` / `@scope:registry` rows show the merged routes — the
53
+ // values `config get` answers — so a raw `.npmrc` row cannot contradict
54
+ // the resolved `registries` view.
55
+ for (const [scope, url] of Object.entries(config.registriesByScope ?? {})) {
56
+ result[scope === 'default' ? 'registry' : `${scope}:registry`] = url;
57
+ }
43
58
  // Always include user-agent for debugging connectivity issues
44
59
  if (config.userAgent) {
45
60
  result.userAgent = config.userAgent;
46
61
  }
62
+ result.registries = toResolvedRegistryDeclarations(pickRegistryContext(config));
63
+ const update = toUpdateSettings(config.updateConfig);
64
+ if (update != null) {
65
+ result.update = update;
66
+ }
67
+ const audit = toAuditSettings(config);
68
+ if (audit != null) {
69
+ result.audit = audit;
70
+ }
71
+ // `catalogs` shows the complete resolved catalog set — the singular
72
+ // `catalog` block is its `default` entry — whichever spelling declared it.
73
+ if (config.catalogs != null && Object.values(config.catalogs).some((catalog) => catalog != null)) {
74
+ result.catalogs = config.catalogs;
75
+ }
47
76
  return censorProtectedSettings(sortDirectKeys(result));
48
77
  }
49
78
  //# sourceMappingURL=configToRecord.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/config.commands",
3
- "version": "1100.1.0",
3
+ "version": "1101.0.0",
4
4
  "description": "Commands for reading and writing settings to/from config files",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -28,14 +28,15 @@
28
28
  "!*.map"
29
29
  ],
30
30
  "dependencies": {
31
- "@pnpm/cli.utils": "1101.0.23",
32
- "@pnpm/config.reader": "1101.17.0",
33
- "@pnpm/constants": "1101.0.0",
34
- "@pnpm/error": "1100.1.2",
31
+ "@pnpm/cli.utils": "1101.0.24",
32
+ "@pnpm/config.normalize-registries": "1101.0.0",
33
+ "@pnpm/config.reader": "1102.0.0",
34
+ "@pnpm/constants": "1102.0.0",
35
+ "@pnpm/error": "1100.1.3",
35
36
  "@pnpm/object.key-sorting": "1100.0.2",
36
- "@pnpm/object.property-path": "1100.1.4",
37
+ "@pnpm/object.property-path": "1100.1.5",
37
38
  "@pnpm/text.naming-cases": "1100.0.2",
38
- "@pnpm/workspace.workspace-manifest-writer": "1100.1.0",
39
+ "@pnpm/workspace.workspace-manifest-writer": "1100.1.1",
39
40
  "camelcase": "^9.0.0",
40
41
  "ini": "6.0.0",
41
42
  "lodash.kebabcase": "^4.1.1",
@@ -49,9 +50,9 @@
49
50
  },
50
51
  "devDependencies": {
51
52
  "@jest/globals": "30.4.1",
52
- "@pnpm/config.commands": "1100.1.0",
53
+ "@pnpm/config.commands": "1101.0.0",
53
54
  "@pnpm/logger": "1100.0.0",
54
- "@pnpm/prepare": "1100.0.26",
55
+ "@pnpm/prepare": "1100.0.27",
55
56
  "@types/ini": "4.1.1",
56
57
  "@types/lodash.kebabcase": "4.1.9",
57
58
  "read-yaml-file": "^3.0.0"