Skip to content

Pure store#524

Merged
zkochan merged 57 commits into
masterfrom
pure-store
Jan 8, 2017
Merged

Pure store#524
zkochan merged 57 commits into
masterfrom
pure-store

Conversation

@zkochan

@zkochan zkochan commented Jan 2, 2017

Copy link
Copy Markdown
Member

Details here: #519

Additional notes:

  • Life-cycle events related to installation work on the realpath (which does not have the node_modules folder anymore), so packages that have install scripts, are copied instead of symlinked.
  • Bundled dependencies are ignore for now (they are installed as usual dependencies). To support bundled dependencies some operations have to be made less concurrent (which is probably OK).

Should solve: #400, #397, #315

Should allow implementing of: #508 (Offline support)

@rstacruz

rstacruz commented Jan 4, 2017

Copy link
Copy Markdown
Member

Maybe we'll have to make the dependency trees flat as npm and yarn.

Yeah... in hindsight this seems like a good idea now.

Comment thread README.md Outdated
## 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not ~/.pnpm/store or ~/.pnpm-store?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/api/constantDefaults.ts Outdated
@@ -1,2 +1,2 @@
export const GlobalPath = '~/.pnpm'
export const GlobalStorePath = GlobalPath + '/.store'
export const GlobalStorePath = '~/.store'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I think usual custom conventions are more like GLOBAL_PATH = '~/.pnpm' but thats just a preference for me :)

@zkochan

zkochan commented Jan 4, 2017

Copy link
Copy Markdown
Member Author

Maybe we'll have to make the dependency trees flat as npm and yarn.

Yeah... in hindsight this seems like a good idea now.

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.

@zkochan zkochan merged commit 38837b1 into master Jan 8, 2017
@zkochan zkochan deleted the pure-store branch January 8, 2017 13:47
@iamstarkov

Copy link
Copy Markdown
Contributor

oh, shi~ thats a huge pr. good job, @zkochan!

pull Bot pushed a commit to dwongdev/pnpm that referenced this pull request May 14, 2026
…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`.
github-actions Bot pushed a commit to Eyalm321/pnpm that referenced this pull request May 18, 2026
…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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants