Pure store#524
Conversation
cf7e41f to
cd33ab8
Compare
Yeah... in hindsight this seems like a good idea now. |
| ## Background | ||
|
|
||
| `pnpm` maintains a flat storage of all your dependencies in `node_modules/.store`. They are then symlinked wherever they're needed. | ||
| `pnpm` maintains a flat storage of all your dependencies in `~/.store`. They are then symlinked wherever they're needed. |
There was a problem hiding this comment.
why not ~/.pnpm/store or ~/.pnpm-store?
There was a problem hiding this comment.
Because hopefully we will use the same store structure as ied. Though maybe .pnpm-store is a good idea till the specs are not finished
| @@ -1,2 +1,2 @@ | |||
| export const GlobalPath = '~/.pnpm' | |||
| export const GlobalStorePath = GlobalPath + '/.store' | |||
| export const GlobalStorePath = '~/.store' | |||
There was a problem hiding this comment.
hmm, I think usual custom conventions are more like GLOBAL_PATH = '~/.pnpm' but thats just a preference for me :)
I thought there would be problems with long directory names but I came up with this idea of "node_modules/.resolutions" folder which is kinda the old store with the node_modules included. So flat trees can be avoided in this PR. |
a4409ab to
0529082
Compare
BREAKING CHANGE: drop support of Node.js pre-6.3
It is not used anymore
--preserve-symlinks makes tests fail on Node.js 4
When trying to install into a node_modules created by older pnpm
From `~/.store` to `~/.pnpm-store`
|
oh, shi~ thats a huge pr. good job, @zkochan! |
…sions (pnpm#524) pnpm writes importer dependency `version:` fields in three shapes: bare semver-with-peer (`4.0.0`), `link:<path>`, or — when a specifier (typically `catalog:`) resolves to a different package name — the full npm-alias `<name>@<version>`. The third shape is what `refToRelative` recognises with the same leading-`@` / `@` before `(`/`:` test that `SnapshotDepRef` already uses, and which pnpm v11 emits for entries like: js-yaml: specifier: 'catalog:' version: '@zkochan/js-yaml@0.0.11' Pacquet's `ImporterDepVersion` only modelled `Regular` and `Link`, so deserialising a lockfile with an aliased catalog dep failed with "Failed to parse importer dependency version". Add an `Alias(PkgNameVerPeer)` variant and a `resolved_key` helper that returns the correct snapshot-map key for each shape — the importer-map key paired with the version for `Regular`, the alias's own `(name, suffix)` for `Alias`, and `None` for `Link`. Every site that previously built a key from `as_regular().map(|v| PkgNameVerPeer::new(name, v))` now goes through `resolved_key`, so aliased deps reach the snapshot, the skipped-set, the reachability BFS, the build-sequence root walk, the runtime exclusion check, and both hoist passes correctly. For symlink targets, an aliased dep links the importer-key name to `<slot>/node_modules/<alias-real-name>` (the resolved package's true name inside its slot), matching pnpm's `linkDirectDeps`. The `pnpm:root added` event now reports `realName` as the resolved package name for aliases, where before it always echoed the importer-map key. Upstream reference: `refToRelative` in `pnpm/pnpm@8a80235/deps/path/src/index.ts:96-110`.
…sions (pnpm#524) pnpm writes importer dependency `version:` fields in three shapes: bare semver-with-peer (`4.0.0`), `link:<path>`, or — when a specifier (typically `catalog:`) resolves to a different package name — the full npm-alias `<name>@<version>`. The third shape is what `refToRelative` recognises with the same leading-`@` / `@` before `(`/`:` test that `SnapshotDepRef` already uses, and which pnpm v11 emits for entries like: js-yaml: specifier: 'catalog:' version: '@zkochan/js-yaml@0.0.11' Pacquet's `ImporterDepVersion` only modelled `Regular` and `Link`, so deserialising a lockfile with an aliased catalog dep failed with "Failed to parse importer dependency version". Add an `Alias(PkgNameVerPeer)` variant and a `resolved_key` helper that returns the correct snapshot-map key for each shape — the importer-map key paired with the version for `Regular`, the alias's own `(name, suffix)` for `Alias`, and `None` for `Link`. Every site that previously built a key from `as_regular().map(|v| PkgNameVerPeer::new(name, v))` now goes through `resolved_key`, so aliased deps reach the snapshot, the skipped-set, the reachability BFS, the build-sequence root walk, the runtime exclusion check, and both hoist passes correctly. For symlink targets, an aliased dep links the importer-key name to `<slot>/node_modules/<alias-real-name>` (the resolved package's true name inside its slot), matching pnpm's `linkDirectDeps`. The `pnpm:root added` event now reports `realName` as the resolved package name for aliases, where before it always echoed the importer-map key. Upstream reference: `refToRelative` in `pnpm/pnpm@8a80235/deps/path/src/index.ts:96-110`.
Details here: #519
Additional notes:
Should solve: #400, #397, #315
Should allow implementing of: #508 (Offline support)