Skip to content

Commit 8d6d851

Browse files
authored
feat: added --install-strategy=linked (#6078)
Co-authored-by: Vincent Bailly <[email protected]> Implements the RFC https://github.com/npm/rfcs/blob/main/accepted/0042-isolated-mode.md Packages are installed in node_modules/.store flat, and linked into the node_modules tree in depth, rather than hoisted.
1 parent 6af152b commit 8d6d851

File tree

24 files changed

+2783
-88
lines changed

24 files changed

+2783
-88
lines changed

DEPENDENCIES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ graph LR;
618618
npmcli-arborist-->semver;
619619
npmcli-arborist-->ssri;
620620
npmcli-arborist-->tap;
621+
npmcli-arborist-->tar-stream;
621622
npmcli-arborist-->tcompare;
622623
npmcli-arborist-->treeverse;
623624
npmcli-arborist-->walk-up-path;

lib/utils/config/definitions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,14 +1090,14 @@ define('install-links', {
10901090

10911091
define('install-strategy', {
10921092
default: 'hoisted',
1093-
type: ['hoisted', 'nested', 'shallow'],
1093+
type: ['hoisted', 'nested', 'shallow', 'linked'],
10941094
description: `
10951095
Sets the strategy for installing packages in node_modules.
10961096
hoisted (default): Install non-duplicated in top-level, and duplicated as
10971097
necessary within directory structure.
10981098
nested: (formerly --legacy-bundling) install in place, no hoisting.
10991099
shallow (formerly --global-style) only install direct deps at top-level.
1100-
linked: (coming soon) install in node_modules/.store, link in place,
1100+
linked: (experimental) install in node_modules/.store, link in place,
11011101
unhoisted.
11021102
`,
11031103
flatten,

node_modules/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
!/are-we-there-yet
4444
!/are-we-there-yet/node_modules/
4545
/are-we-there-yet/node_modules/*
46-
!/are-we-there-yet/node_modules/buffer
4746
!/are-we-there-yet/node_modules/readable-stream
4847
!/balanced-match
4948
!/base64-js
5049
!/bin-links
5150
!/binary-extensions
5251
!/brace-expansion
52+
!/buffer
5353
!/builtins
5454
!/cacache
5555
!/chalk
File renamed without changes.

package-lock.json

Lines changed: 90 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,29 +2776,6 @@
27762776
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
27772777
}
27782778
},
2779-
"node_modules/are-we-there-yet/node_modules/buffer": {
2780-
"version": "6.0.3",
2781-
"funding": [
2782-
{
2783-
"type": "github",
2784-
"url": "https://github.com/sponsors/feross"
2785-
},
2786-
{
2787-
"type": "patreon",
2788-
"url": "https://www.patreon.com/feross"
2789-
},
2790-
{
2791-
"type": "consulting",
2792-
"url": "https://feross.org/support"
2793-
}
2794-
],
2795-
"inBundle": true,
2796-
"license": "MIT",
2797-
"dependencies": {
2798-
"base64-js": "^1.3.1",
2799-
"ieee754": "^1.2.1"
2800-
}
2801-
},
28022779
"node_modules/are-we-there-yet/node_modules/readable-stream": {
28032780
"version": "4.2.0",
28042781
"inBundle": true,
@@ -2921,6 +2898,12 @@
29212898
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
29222899
"dev": true
29232900
},
2901+
"node_modules/b4a": {
2902+
"version": "1.6.1",
2903+
"resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.1.tgz",
2904+
"integrity": "sha512-AsKjNhz72yxteo/0EtQEiwkMUgk/tGmycXlbG4g3Ard2/ULtNLUykGOkeK0egmN27h0xMAhb76jYccW+XTBExA==",
2905+
"dev": true
2906+
},
29242907
"node_modules/bail": {
29252908
"version": "2.0.2",
29262909
"resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz",
@@ -3000,6 +2983,32 @@
30002983
"node": ">=10"
30012984
}
30022985
},
2986+
"node_modules/bl": {
2987+
"version": "6.0.0",
2988+
"resolved": "https://registry.npmjs.org/bl/-/bl-6.0.0.tgz",
2989+
"integrity": "sha512-Ik9BVIMdcWzSOCpzDv2XpQ4rJ4oZBuk3ck6MgiOv0EopdgtohN2uSCrrLlkH1Jf0KnpZZMBA3D0bUMbCdj/jgA==",
2990+
"dev": true,
2991+
"dependencies": {
2992+
"buffer": "^6.0.3",
2993+
"inherits": "^2.0.4",
2994+
"readable-stream": "^4.2.0"
2995+
}
2996+
},
2997+
"node_modules/bl/node_modules/readable-stream": {
2998+
"version": "4.3.0",
2999+
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.3.0.tgz",
3000+
"integrity": "sha512-MuEnA0lbSi7JS8XM+WNJlWZkHAAdm7gETHdFK//Q/mChGyj2akEFtdLZh32jSdkWGbRwCW9pn6g3LWDdDeZnBQ==",
3001+
"dev": true,
3002+
"dependencies": {
3003+
"abort-controller": "^3.0.0",
3004+
"buffer": "^6.0.3",
3005+
"events": "^3.3.0",
3006+
"process": "^0.11.10"
3007+
},
3008+
"engines": {
3009+
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
3010+
}
3011+
},
30033012
"node_modules/boolbase": {
30043013
"version": "1.0.0",
30053014
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
@@ -3054,6 +3063,30 @@
30543063
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
30553064
}
30563065
},
3066+
"node_modules/buffer": {
3067+
"version": "6.0.3",
3068+
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
3069+
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
3070+
"funding": [
3071+
{
3072+
"type": "github",
3073+
"url": "https://github.com/sponsors/feross"
3074+
},
3075+
{
3076+
"type": "patreon",
3077+
"url": "https://www.patreon.com/feross"
3078+
},
3079+
{
3080+
"type": "consulting",
3081+
"url": "https://feross.org/support"
3082+
}
3083+
],
3084+
"inBundle": true,
3085+
"dependencies": {
3086+
"base64-js": "^1.3.1",
3087+
"ieee754": "^1.2.1"
3088+
}
3089+
},
30573090
"node_modules/buffer-from": {
30583091
"version": "1.1.2",
30593092
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
@@ -4964,6 +4997,12 @@
49644997
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
49654998
"dev": true
49664999
},
5000+
"node_modules/fast-fifo": {
5001+
"version": "1.1.0",
5002+
"resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.1.0.tgz",
5003+
"integrity": "sha512-Kl29QoNbNvn4nhDsLYjyIAaIqaJB6rBx5p3sL9VjaefJ+eMFBWVZiaoguaoZfzEKr5RhAti0UgM8703akGPJ6g==",
5004+
"dev": true
5005+
},
49675006
"node_modules/fast-json-stable-stringify": {
49685007
"version": "2.1.0",
49695008
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@@ -9845,6 +9884,12 @@
98459884
],
98469885
"peer": true
98479886
},
9887+
"node_modules/queue-tick": {
9888+
"version": "1.0.1",
9889+
"resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz",
9890+
"integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==",
9891+
"dev": true
9892+
},
98489893
"node_modules/quick-lru": {
98499894
"version": "4.0.1",
98509895
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz",
@@ -10930,6 +10975,16 @@
1093010975
"escodegen": "^1.8.1"
1093110976
}
1093210977
},
10978+
"node_modules/streamx": {
10979+
"version": "2.13.2",
10980+
"resolved": "https://registry.npmjs.org/streamx/-/streamx-2.13.2.tgz",
10981+
"integrity": "sha512-+TWqixPhGDXEG9L/XczSbhfkmwAtGs3BJX5QNU6cvno+pOLKeszByWcnaTu6dg8efsTYqR8ZZuXWHhZfgrxMvA==",
10982+
"dev": true,
10983+
"dependencies": {
10984+
"fast-fifo": "^1.1.0",
10985+
"queue-tick": "^1.0.1"
10986+
}
10987+
},
1093310988
"node_modules/string_decoder": {
1093410989
"version": "1.3.0",
1093510990
"inBundle": true,
@@ -13193,6 +13248,17 @@
1319313248
"node": ">=10"
1319413249
}
1319513250
},
13251+
"node_modules/tar-stream": {
13252+
"version": "3.0.0",
13253+
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.0.0.tgz",
13254+
"integrity": "sha512-O6OfUKBbQOqAhh6owTWmA730J/yZCYcpmZ1DBj2YX51ZQrt7d7NgzrR+CnO9wP6nt/viWZW2XeXLavX3/ZEbEg==",
13255+
"dev": true,
13256+
"dependencies": {
13257+
"b4a": "^1.6.1",
13258+
"bl": "^6.0.0",
13259+
"streamx": "^2.12.5"
13260+
}
13261+
},
1319613262
"node_modules/tcompare": {
1319713263
"version": "5.0.7",
1319813264
"resolved": "https://registry.npmjs.org/tcompare/-/tcompare-5.0.7.tgz",
@@ -14351,6 +14417,7 @@
1435114417
"minify-registry-metadata": "^3.0.0",
1435214418
"nock": "^13.2.0",
1435314419
"tap": "^16.3.2",
14420+
"tar-stream": "^3.0.0",
1435414421
"tcompare": "^5.0.6"
1435514422
},
1435614423
"engines": {

smoke-tests/tap-snapshots/test/index.js.test.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ npm ERR! npm ci
5555
npm ERR!
5656
npm ERR! Options:
5757
npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
58-
npm ERR! [-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
59-
npm ERR! [--legacy-bundling] [--global-style]
60-
npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
58+
npm ERR! [-E|--save-exact] [-g|--global]
59+
npm ERR! [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
60+
npm ERR! [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
6161
npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
6262
npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
6363
npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]

0 commit comments

Comments
 (0)