Commit Graph

24 Commits

Author SHA1 Message Date
Zoltan Kochan
eba01e6ad3 fix: handle non-native Error throws in requirePnpmfile (#11081)
* fix: handle non-native Error throws in requirePnpmfile

When a pnpmfile throws a non-native Error value (e.g. a string),
`assert(util.types.isNativeError(err))` crashes pnpm with an
unhelpful assertion failure. Replace the assertion with a guard
that wraps non-native errors into a proper Error and reports them
via PnpmFileFailError.

* fix: improve non-native error wrapping with toError helper
2026-03-24 18:33:03 +01:00
Zoltan Kochan
4a36b9a110 refactor: rename internal packages to @pnpm/<domain>.<leaf> convention (#10997)
## Summary

Rename all internal packages so their npm names follow the `@pnpm/<domain>.<leaf>` convention, matching their directory structure. Also rename directories to remove redundancy and improve clarity.

### Bulk rename (94 packages)

All `@pnpm/` packages now derive their name from their directory path using dot-separated segments. Exceptions: `packages/`, `__utils__/`, and `pnpm/artifacts/` keep leaf names only.

### Directory renames (removing redundant prefixes)

- `cli/cli-meta` → `cli/meta`, `cli/cli-utils` → `cli/utils`
- `config/config` → `config/reader`, `config/config-writer` → `config/writer`
- `fetching/fetching-types` → `fetching/types`
- `lockfile/lockfile-to-pnp` → `lockfile/to-pnp`
- `store/store-connection-manager` → `store/connection-manager`
- `store/store-controller-types` → `store/controller-types`
- `store/store-path` → `store/path`

### Targeted renames (clarity improvements)

- `deps/dependency-path` → `deps/path` (`@pnpm/deps.path`)
- `deps/calc-dep-state` → `deps/graph-hasher` (`@pnpm/deps.graph-hasher`)
- `deps/inspection/dependencies-hierarchy` → `deps/inspection/tree-builder` (`@pnpm/deps.inspection.tree-builder`)
- `bins/link-bins` → `bins/linker`, `bins/remove-bins` → `bins/remover`, `bins/package-bins` → `bins/resolver`
- `installing/get-context` → `installing/context`
- `store/package-store` → `store/controller`
- `pkg-manifest/manifest-utils` → `pkg-manifest/utils`

### Manifest reader/writer renames

- `workspace/read-project-manifest` → `workspace/project-manifest-reader` (`@pnpm/workspace.project-manifest-reader`)
- `workspace/write-project-manifest` → `workspace/project-manifest-writer` (`@pnpm/workspace.project-manifest-writer`)
- `workspace/read-manifest` → `workspace/workspace-manifest-reader` (`@pnpm/workspace.workspace-manifest-reader`)
- `workspace/manifest-writer` → `workspace/workspace-manifest-writer` (`@pnpm/workspace.workspace-manifest-writer`)

### Workspace package renames

- `workspace/find-packages` → `workspace/projects-reader`
- `workspace/find-workspace-dir` → `workspace/root-finder`
- `workspace/resolve-workspace-range` → `workspace/range-resolver`
- `workspace/filter-packages-from-dir` merged into `workspace/filter-workspace-packages` → `workspace/projects-filter`

### Domain moves

- `pkg-manifest/read-project-manifest` → `workspace/project-manifest-reader`
- `pkg-manifest/write-project-manifest` → `workspace/project-manifest-writer`
- `pkg-manifest/exportable-manifest` → `releasing/exportable-manifest`

### Scope

- 1206 files changed
- Updated: package.json names/deps, TypeScript imports, tsconfig references, changeset files, renovate.json, test fixtures, import ordering
2026-03-17 21:50:40 +01:00
Zoltan Kochan
5d5818e44f style: enforce node: protocol for builtin imports (#10951)
Add n/prefer-node-protocol rule and autofix all bare builtin imports
to use the node: prefix. Simplify the simple-import-sort builtins
pattern to just ^node: since all imports now use the prefix.
2026-03-13 07:59:51 +01:00
Zoltan Kochan
1c8c4e49f5 style: add eslint-plugin-simple-import-sort (#10947)
Add eslint-plugin-simple-import-sort to enforce consistent import ordering:
- Node.js builtins first
- External packages second
- Relative imports last
- Named imports sorted alphabetically within each statement
2026-03-13 02:02:38 +01:00
Brandon Cheng
01914345d5 build: enable @typescript-eslint/no-import-type-side-effects (#10630)
* build: enable `@typescript-eslint/no-import-type-side-effects`

* build: disable `@typescript-eslint/consistent-type-imports`

* chore: apply fixes for `no-import-type-side-effects`

pnpm exec eslint "**/src/**/*.ts" "**/test/**/*.ts" --fix
2026-03-08 00:02:48 +01:00
Zoltan Kochan
de561a55fa fix: prefer .pnpmfile.mjs by default (#10683)
* fix: prefer .pnpmfile.mjs by default

* fix: handle ERR_MODULE_NOT_FOUND for missing optional .pnpmfile.mjs

Node's dynamic import() throws ERR_MODULE_NOT_FOUND (not MODULE_NOT_FOUND
like require()) when a file doesn't exist. This caused a hard error when
tryLoadDefaultPnpmfile was enabled and .pnpmfile.mjs was absent.

* fix: load only .pnpmfile.mjs when it exists, not both .mjs and .cjs

When both .pnpmfile.mjs and .pnpmfile.cjs exist, only the .mjs file
is now loaded. Previously both were loaded and their hooks combined.
Also adds .mjs support for config dependency plugins.
2026-03-01 17:00:33 +01:00
Zoltan Kochan
e146e988ea feat: loading ESM pnpmfiles (#9730) 2025-10-10 09:50:21 +02:00
Zoltan Kochan
a5081066be test(pnpmfile): fix 2025-09-13 00:02:16 +02:00
Zoltan Kochan
6f861bccaa Merge remote-tracking branch 'origin/main' into v11 2025-09-12 22:35:14 +02:00
Zoltan Kochan
e792927841 feat: support finder functions for performing complex searches with list and why commands (#9946) 2025-09-12 11:46:32 +02:00
Zoltan Kochan
491a84fb26 feat: use ESM instead of commonjs (#9870) 2025-08-25 10:02:00 +02:00
Zoltan Kochan
27cbc09206 style: fix jest-related linting issues (#9894) 2025-08-22 21:56:49 +02:00
Zoltan Kochan
facd7656e8 refactor: always use extensions in relative imports (#9878) 2025-08-19 15:25:11 +02:00
Zoltan Kochan
295db51ef9 fix: the default pnpmfile should only be loaded if the pnpmfile settings is not set (#9731) 2025-07-09 11:00:52 +02:00
Zoltan Kochan
e2253105d0 feat: loading pnpmfiles automatically from plugins (#9729) 2025-07-08 22:00:37 +02:00
Zoltan Kochan
cf630a8e84 feat: allow to set multiple pnpmfiles (#9702) 2025-07-08 14:54:07 +02:00
Zoltan Kochan
1413c25435 feat: config update hook (#9325) 2025-03-31 08:08:32 +02:00
Zoltan Kochan
1dd419cbb4 test: fix killing the registry mock server on teardown (#8695) 2024-10-25 21:24:08 +02:00
Khải
9b4f73caaf chore(scripts): typecheck-only (#8395)
* chore(scripts): typecheck-only

* feat: change all configuration

* feat: include pnpm/ and pnpm/test/

* chore(deps): remove unused dependency

* refactor(typescript-only): use find-packages

* refactor(typescript-only): refactor paths

* fix: typescript-only

* fix: update compile-only

* fix: compile pnpm

* fix: windows

* fix: windows

* chore: meta-updater

* refactor(tsconfig): remove explicit composite

* fix: path in windows

* feat: don't depend on cwd

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2024-08-11 08:26:01 +02:00
Brandon Cheng
c7e1b6fae8 chore: configure TypeScript project references for tests (#8128)
* refactor: store link values before converting to references

* fix: use .sort() without localeCompare

https://github.com/pnpm/pnpm/pull/8128#discussion_r1614031566

> Nit, but you probably just want to call sort without a comparison
> function; these are already strings and locale compare is not a good
> comparison for anything but human readable strings since it will
> differ on different people's machines based on their language setting.
> I've hit this too many times before for code gen.

* feat: configure meta-updater to write test/tsconfig.json files

* fix: relative imports for __typings__

* chore: `pnpm run meta-updater`

* fix: explicitly use test/tsconfig.json for ts-jest
2024-05-31 12:48:13 +02:00
Khải
18f4060ac8 refactor(pnpmfile): add some typings (#7899)
* refactor(pnpmfile): add some typings

* lint: fix
2024-04-11 13:55:20 +02:00
Khải
086b69cf60 feat: pnpmfileChecksum (#7662)
* Squashed commit of the following:

commit 912ee1af4d954d192d42cf4a2e6dae56d5bef21d
Author: Zoltan Kochan <z@kochan.io>
Date:   Thu Feb 22 02:22:22 2024 +0100

    revert: moving tarballs to lfs

commit f8943bdfd422c77e27febda9d962e9937c83dd55
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Wed Feb 21 20:35:38 2024 +0700

    refactor: move pnpmfileChecksum to requireHooks

commit 33c90e030f49aa9edf815708f846047d7dec25ca
Merge: d6e74263d 5f4b535be
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Wed Feb 21 12:06:26 2024 +0700

    chore(git): merge

commit d6e74263de8ea474b1c16cd29aac2dbdef40d102
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Wed Feb 21 12:03:13 2024 +0700

    refactor: reuse code

commit 5f4b535bed589bb5eb60ddbbb61534d62e75cfae
Author: Khải <hvksmr1996@gmail.com>
Date:   Wed Feb 21 10:21:35 2024 +0700

    refactor: revert unnecessary bumps

commit ebee6c825d08888413684856c7505d4708c960af
Merge: 82233556d c8e8eca3d
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Wed Feb 21 00:37:50 2024 +0700

    chore(git): merge from main

commit c8e8eca3debb0fb081a614346b9b1a5786b87a5d
Author: Zoltan Kochan <z@kochan.io>
Date:   Tue Feb 20 18:36:11 2024 +0100

    test(mount-modules): use local pnpm in pretest

commit e0488e5ac443b62df3aef9a161c757bc16c1bda3
Author: Zoltan Kochan <z@kochan.io>
Date:   Tue Feb 20 18:28:21 2024 +0100

    fix: unpacking tarballs that appear to be not USTAR or GNU TAR (#7677)

    close #7120

commit 82233556d4162d90a38e11d15136461008169acd
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Tue Feb 20 20:32:47 2024 +0700

    refactor: replace remove with add

commit 30293df6bdc8cc478b9d7b81cb5d09ca48855b89
Merge: 6eb0b3e81 7cb3cfb5b
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Tue Feb 20 20:31:30 2024 +0700

    chore(git): merge from main

commit 6eb0b3e81dea7ced23b4e9683d9500b4a30499a5
Merge: c1fbc11ed e4caa114a
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Tue Feb 20 16:45:23 2024 +0700

    chore(git): merge from main

commit c1fbc11eded093e923644454254b98eb0090292d
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Tue Feb 20 13:59:15 2024 +0700

    fix: pruneLockfile

commit 39a8e75a1cccd8c6f5df838eaf2c07f98c2652dd
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Tue Feb 20 02:46:41 2024 +0700

    lint: fix

commit 839de517487561ddf3d27bb77a1cfd8e373c4274
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Mon Feb 19 20:24:25 2024 +0700

    style: fix

commit 1ec2c1a40fb050221b937878decd9eeef8e9c845
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Mon Feb 19 20:01:00 2024 +0700

    feat: handle absolute path

commit 002edd4484a071638b6e2f43ab9ce76f186aa379
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Mon Feb 19 19:51:33 2024 +0700

    fix: use opts instead of rawConfig

commit d55b687735b598e7a2b235eaed5675eaf1982a40
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Mon Feb 19 19:41:51 2024 +0700

    refactor: remove an unnecessary await

commit bb595f315b8ba422128efc1ff753222c86e93fdf
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Mon Feb 19 14:08:07 2024 +0700

    feat: rawConfig.ignorePnpmfile

commit 0a17c659d303054d770e72279019b9c39e85c95d
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Mon Feb 19 14:04:13 2024 +0700

    feat: read from rawConfig

commit 276379a531163ca6271fa863c27f3c779a6849a4
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Mon Feb 19 13:53:34 2024 +0700

    feat: move pnpmfileChecksum to the option region

commit 3868abdbb25194ef5b279cfea63fab6294d46a8c
Author: Zoltan Kochan <z@kochan.io>
Date:   Sat Feb 17 00:09:19 2024 +0100

    test: fix

commit 95e6554089d30dcee25da144719b28e369d11f10
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Fri Feb 16 23:18:11 2024 +0700

    fix: test

commit 75a131aade4caa322330f6df017abd02aee0ccd9
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Fri Feb 16 23:17:45 2024 +0700

    fix: pnpmfileChecksum not appearing in the lockfile

commit 297f920b0be4671b72481709af43193522b177b3
Merge: 8ac1725a8 c7d056422
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Fri Feb 16 18:12:11 2024 +0700

    chore(git): merge from main

commit 8ac1725a83b3eccfe46b2972a77f7a780aef3564
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Fri Feb 16 18:01:58 2024 +0700

    feat: pnpmfileChecksum

commit 83788d023d478d4e559ebfbaaf2aba6e355358b5
Author: khai96_ <hvksmr1996@gmail.com>
Date:   Fri Feb 16 17:04:02 2024 +0700

    refactor: add explicit type

* fix: update lockfile when new pnpmfile removes deps

* fix: always calculate pnpmfileChecksum

* test: getPnpmfileChecksum

* test(cli): add or change pnpmfile

* refactor: try catch and await

* refactor: pnpmfile hash

* docs: add changesets

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2024-02-23 19:17:38 +01:00
Zoltan Kochan
ee61ca4cb7 style: update eslint (#6236) 2023-03-18 14:57:29 +02:00
Zoltan Kochan
4ca53b0b50 refactor: group projects in different subdirectories (#5659) 2022-11-20 01:35:22 +02:00