Commit Graph
4 Commits
Author SHA1 Message Date
Zoltan Kochan d45bfb1174 refactor(ts): meet size and shape limits in 5 packages (#16451)
* refactor(ts): meet size and shape limits in 5 packages

Refactor 5 TypeScript packages to satisfy strict size and shape lint limits
(function length, nesting, cognitive complexity, local declarations):
- `@pnpm/lockfile.pruner`
- `@pnpm/network.agent`
- `@pnpm/resolving.default-resolver`
- `@pnpm/resolving.local-resolver`
- `@pnpm/resolving.registry.pkg-metadata-filter`

Remove them from PENDING_SIZE_AND_SHAPE_REFACTOR in eslint.config.mjs.

* refactor(registry.pkg-metadata-filter): use options objects for candidate helpers

* perf(network.agent): use cache.get directly to update recency
2026-10-01 02:57:40 +02:00
Zoltan Kochan 4edeef9176 style(ts): port the perfectionist lint rules to ESLint (#16415)
Add TypeScript ports of the perfectionist rules that the Rust workspace
enforces through dylint.toml to @pnpm/eslint-config, with the same limits,
and fix every finding that needs no refactor.

The size and shape rules (function length, cognitive complexity, nesting,
local bindings, file length) are enforced for packages that already meet
them. The packages that do not are listed in PENDING_SIZE_AND_SHAPE_REFACTOR
in eslint.config.mjs and are refactored in follow-up changes.

The custom rules mirror perfectionist's semantics rather than reusing
sonarjs or max-lines-per-function, so that one limit means the same thing
in both codebases: a closure is a level of the body that contains it, a
nested function declaration is measured on its own, and a test-framework
callback plays the role of a #[test] function.

Bugs found and fixed along the way:
- a registry error body cut at exactly 64 KiB lost its truncation marker
- removing a dependency could leave dangling .bin shims
- constructor/__proto__ names crashed the projects graph, were skipped by
  the injected-deps syncer, and were dropped from writeWantedLockfile's
  returned lockfile

The CI chunk runner learns to run the node:test suite of the ESLint
config package.
2026-09-30 15:10:08 +02:00
Zoltan Kochan 48b1e5425c fix(network): cache agents by their effective settings (#16224)
`getAgent` and `getProxyAgent` keyed their agent caches on
`Boolean(strictSsl)`, which maps an omitted strictSsl and an explicit
false to the same key. Node.js verifies certificates when
rejectUnauthorized is omitted, so an insecure agent cached first was
handed to later callers that expected verification. The keys also left
out maxSockets and timeout, so a caller got an agent with another
caller's connection settings.

Both factories now resolve strictSsl, maxSockets, and timeout to their
effective values once, and use those values in the key and the agent.

`pickSettingByUrl` checked candidate keys by truthiness and skipped
settings whose value is false, 0, or an empty string. It now checks
whether the key exists. Its port-stripping fallback appended the slash
after the query string, which turned `/path?a=1` into a URL whose path
was lost when mapped to a registry key. The slash now goes on the path.

None of these packages is used by the pnpm CLI.
2026-09-27 00:30:55 +02:00
Zoltan Kochan ad525f26db refactor: move the pnpm/components packages into the monorepo (#16214)
The remaining packages of the pnpm/components Bit workspace now live
under pnpm11/ and are published from here, keeping their npm names:

  @pnpm/config.env-replace           -> pnpm11/config/env-replace
  @pnpm/log.group                    -> pnpm11/log/group
  @pnpm/network.agent                -> pnpm11/network/agent
  @pnpm/network.ca-file              -> pnpm11/network/ca-file
  @pnpm/network.config               -> pnpm11/network/config
  @pnpm/network.proxy-agent          -> pnpm11/network/proxy-agent
  @pnpm/os.env.path-extender         -> pnpm11/os/env/path-extender
  @pnpm/os.env.path-extender-posix   -> pnpm11/os/env/path-extender-posix
  @pnpm/os.env.path-extender-windows -> pnpm11/os/env/path-extender-windows

lex-comparator and nerf-dart were already moved under new names, and the
Bit env component is build tooling with no counterpart here.

The sources are carried over from pnpm/components at 42ec0f7, which
includes the Windows fix that rewrites a PNPM_HOME value stored with the
wrong registry type. pnpm v12 got the same fix in pnpm/pnpm#15746, so
its changeset now also covers pnpm v11, which bundles the workspace copy.

Porting to the monorepo's ES module setup:

- relative imports carry .js and type re-exports are marked `type`;
- tests use jest.unstable_mockModule and import through the package;
- string.prototype.matchall and graceful-fs give way to built-ins;
- safe-execa and lru-cache move to the catalog versions (0.3, 11);
- network.config depends on @pnpm/config.registry-auth-key;
- the strict-ssl proxy test uses node:https and proxy v4 instead of
  node-fetch and proxy v1.

The packages start at 1100.0.0 to sit in the pnpm11 version band.
2026-09-26 23:33:47 +02:00