What do "idealTree" and "reify" mean in the context of npm?
Asked Answered
R

1

46

When creating a react app via "npx create-react-app [app_name]" I noticed the console log something like [#############] idealTree:[package-name]... and then the same thing with "reify" instead of "idealTree". When I search what these terms mean I only see questions relating to package installations failing.

Raddy answered 16/9, 2022 at 22:3 Comment(5)
And you searched the web for... what terms? Because if I google for this, I find plenty of sites (and even other SO posts) that explain what those two terms mean. Also remember that npm itself is open source, and searching the repo for those two terms will give you quite a bit of solid clues to work with.Polyethylene
I can't find anything about what "idealTree" or "reify" mean in regards to npm specifically. I am assuming "idealTree" is some kind of dependency graph and "reify" actually installs the dependencies in the graph.Raddy
If you don't want to go code/commit diving, then I'd recommend asking the npm folks to document what those mean in the official NPM docs, so that everyone can learn about them in the most obvious spot.Polyethylene
Comments are used to ask for clarification or to point out problems in the post. Outdated comments may get deleted.Taciturnity
Slowness during npm install.Strabismus
B
43

The idealTree meaning is explained in the npm source code file validate-lockfile.js:

// compares the inventory of package items in the tree
// that is about to be installed (idealTree) with the inventory
// of items stored in the package-lock file (virtualTree)

An idealTree is just the tree that is about to be installed.

In common language reify means:

make (something abstract) more concrete or real.

Reification is then the process or result of reifying.

In the context of npm, we can deduce the meaning from the npm source code file tree-types.md:

During reification, the idealTree is diffed against the actual tree, and then the nodes from the ideal tree are extracted onto disk.

In the context of npm, we can say that reify means making the idealTree concrete.

Bogie answered 23/10, 2022 at 15:43 Comment(3)
This explains a lot, but why do they take so much time? It doesn't seem to me it'd need this huge amount to time to accomplish.Betseybetsy
@NianyiWang Welcome to the word of modern JS development ;)Christianson
Especially with npm ci I'd expect npm to be able to look at the lockfile and construct an entire tree in sub-seconds.Kaki

© 2022 - 2024 — McMap. All rights reserved.