Skip to content

File tree

344 files changed

+31722
-2715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

344 files changed

+31722
-2715
lines changed

DEPENDENCIES.md

+3-24
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ graph LR;
88
bin-links-->read-cmd-shim;
99
bin-links-->write-file-atomic;
1010
cacache-->fs-minipass;
11-
cacache-->infer-owner;
1211
cacache-->npmcli-fs["@npmcli/fs"];
1312
cacache-->npmcli-move-file["@npmcli/move-file"];
1413
cacache-->ssri;
@@ -37,7 +36,6 @@ graph LR;
3736
libnpmexec-->npmcli-arborist["@npmcli/arborist"];
3837
libnpmexec-->npmcli-ci-detect["@npmcli/ci-detect"];
3938
libnpmexec-->npmcli-eslint-config["@npmcli/eslint-config"];
40-
libnpmexec-->npmcli-fs["@npmcli/fs"];
4139
libnpmexec-->npmcli-run-script["@npmcli/run-script"];
4240
libnpmexec-->npmcli-template-oss["@npmcli/template-oss"];
4341
libnpmexec-->npmlog;
@@ -121,7 +119,6 @@ graph LR;
121119
npm-->npmcli-config["@npmcli/config"];
122120
npm-->npmcli-docs["@npmcli/docs"];
123121
npm-->npmcli-eslint-config["@npmcli/eslint-config"];
124-
npm-->npmcli-fs["@npmcli/fs"];
125122
npm-->npmcli-git["@npmcli/git"];
126123
npm-->npmcli-map-workspaces["@npmcli/map-workspaces"];
127124
npm-->npmcli-package-json["@npmcli/package-json"];
@@ -195,7 +192,6 @@ graph LR;
195192
npmcli-config-->semver;
196193
npmcli-docs-->ignore-walk;
197194
npmcli-docs-->npmcli-eslint-config["@npmcli/eslint-config"];
198-
npmcli-docs-->npmcli-fs["@npmcli/fs"];
199195
npmcli-docs-->npmcli-template-oss["@npmcli/template-oss"];
200196
npmcli-fs-->semver;
201197
npmcli-git-->npm-pick-manifest;
@@ -212,16 +208,13 @@ graph LR;
212208
npmcli-metavuln-calculator-->semver;
213209
npmcli-package-json-->json-parse-even-better-errors;
214210
npmcli-promise-spawn-->infer-owner;
215-
npmcli-query-->npm-package-arg;
216-
npmcli-query-->semver;
217211
npmcli-run-script-->npmcli-node-gyp["@npmcli/node-gyp"];
218212
npmcli-run-script-->npmcli-promise-spawn["@npmcli/promise-spawn"];
219213
npmcli-run-script-->read-package-json-fast;
220214
npmlog-->are-we-there-yet;
221215
npmlog-->gauge;
222216
pacote-->cacache;
223217
pacote-->fs-minipass;
224-
pacote-->infer-owner;
225218
pacote-->npm-package-arg;
226219
pacote-->npm-packlist;
227220
pacote-->npm-pick-manifest;
@@ -341,10 +334,8 @@ graph LR;
341334
babel-types-->babel-helper-validator-identifier["@babel/helper-validator-identifier"];
342335
babel-types-->to-fast-properties;
343336
bin-links-->cmd-shim;
344-
bin-links-->mkdirp-infer-owner;
345337
bin-links-->npm-normalize-package-bin;
346338
bin-links-->read-cmd-shim;
347-
bin-links-->rimraf;
348339
bin-links-->write-file-atomic;
349340
bindings-->file-uri-to-path;
350341
bl-->buffer;
@@ -387,7 +378,6 @@ graph LR;
387378
cmark-gfm-->bindings;
388379
cmark-gfm-->node-addon-api;
389380
cmark-gfm-->prebuild-install;
390-
cmd-shim-->mkdirp-infer-owner;
391381
color-convert-->color-name;
392382
columnify-->strip-ansi;
393383
columnify-->wcwidth;
@@ -549,7 +539,6 @@ graph LR;
549539
libnpmexec-->npmcli-arborist["@npmcli/arborist"];
550540
libnpmexec-->npmcli-ci-detect["@npmcli/ci-detect"];
551541
libnpmexec-->npmcli-eslint-config["@npmcli/eslint-config"];
552-
libnpmexec-->npmcli-fs["@npmcli/fs"];
553542
libnpmexec-->npmcli-run-script["@npmcli/run-script"];
554543
libnpmexec-->npmcli-template-oss["@npmcli/template-oss"];
555544
libnpmexec-->npmlog;
@@ -751,7 +740,6 @@ graph LR;
751740
npm-->npmcli-config["@npmcli/config"];
752741
npm-->npmcli-docs["@npmcli/docs"];
753742
npm-->npmcli-eslint-config["@npmcli/eslint-config"];
754-
npm-->npmcli-fs["@npmcli/fs"];
755743
npm-->npmcli-git["@npmcli/git"];
756744
npm-->npmcli-map-workspaces["@npmcli/map-workspaces"];
757745
npm-->npmcli-package-json["@npmcli/package-json"];
@@ -845,7 +833,6 @@ graph LR;
845833
npmcli-arborist-->treeverse;
846834
npmcli-arborist-->walk-up-path;
847835
npmcli-config-->ini;
848-
npmcli-config-->mkdirp-infer-owner;
849836
npmcli-config-->nopt;
850837
npmcli-config-->npmcli-map-workspaces["@npmcli/map-workspaces"];
851838
npmcli-config-->proc-log;
@@ -862,11 +849,9 @@ graph LR;
862849
npmcli-docs-->mdx-js-mdx["@mdx-js/mdx"];
863850
npmcli-docs-->mkdirp;
864851
npmcli-docs-->npmcli-eslint-config["@npmcli/eslint-config"];
865-
npmcli-docs-->npmcli-fs["@npmcli/fs"];
866852
npmcli-docs-->npmcli-template-oss["@npmcli/template-oss"];
867853
npmcli-docs-->tap;
868854
npmcli-docs-->yaml;
869-
npmcli-fs-->gar-promisify["@gar/promisify"];
870855
npmcli-fs-->semver;
871856
npmcli-git-->lru-cache;
872857
npmcli-git-->mkdirp;
@@ -891,9 +876,7 @@ graph LR;
891876
npmcli-move-file-->rimraf;
892877
npmcli-package-json-->json-parse-even-better-errors;
893878
npmcli-promise-spawn-->infer-owner;
894-
npmcli-query-->npm-package-arg;
895879
npmcli-query-->postcss-selector-parser;
896-
npmcli-query-->semver;
897880
npmcli-run-script-->node-gyp;
898881
npmcli-run-script-->npmcli-node-gyp["@npmcli/node-gyp"];
899882
npmcli-run-script-->npmcli-promise-spawn["@npmcli/promise-spawn"];
@@ -912,11 +895,8 @@ graph LR;
912895
optionator-->word-wrap;
913896
p-map-->aggregate-error;
914897
pacote-->cacache;
915-
pacote-->chownr;
916898
pacote-->fs-minipass;
917-
pacote-->infer-owner;
918899
pacote-->minipass;
919-
pacote-->mkdirp;
920900
pacote-->npm-package-arg;
921901
pacote-->npm-packlist;
922902
pacote-->npm-pick-manifest;
@@ -929,7 +909,6 @@ graph LR;
929909
pacote-->promise-retry;
930910
pacote-->read-package-json-fast;
931911
pacote-->read-package-json;
932-
pacote-->rimraf;
933912
pacote-->ssri;
934913
pacote-->tar;
935914
parse-conflict-json-->json-parse-even-better-errors;
@@ -1127,6 +1106,6 @@ packages higher up the chain.
11271106
- pacote, libnpmaccess, libnpmhook, libnpmorg, libnpmsearch, libnpmteam, npm-profile
11281107
- npm-registry-fetch, libnpmversion
11291108
- @npmcli/git, make-fetch-happen, @npmcli/config, init-package-json
1130-
- @npmcli/docs, @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, @npmcli/run-script, read-package-json, @npmcli/query, readdir-scoped-modules, promzard
1131-
- @npmcli/fs, npm-bundled, read-package-json-fast, unique-filename, @npmcli/promise-spawn, npm-install-checks, npm-package-arg, npm-packlist, normalize-package-data, @npmcli/package-json, bin-links, nopt, npmlog, parse-conflict-json, dezalgo, read
1132-
- semver, ignore-walk, @npmcli/eslint-config, @npmcli/template-oss, npm-normalize-package-bin, @npmcli/name-from-folder, json-parse-even-better-errors, @npmcli/move-file, fs-minipass, infer-owner, ssri, unique-slug, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/node-gyp, minipass-fetch, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, are-we-there-yet, gauge, wrappy, treeverse, minify-registry-metadata, @npmcli/disparity-colors, @npmcli/ci-detect, mute-stream, ini, npm-audit-report, npm-user-validate
1109+
- @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, @npmcli/run-script, read-package-json, readdir-scoped-modules, promzard
1110+
- @npmcli/docs, npm-bundled, read-package-json-fast, @npmcli/fs, unique-filename, @npmcli/promise-spawn, npm-install-checks, npm-package-arg, npm-packlist, normalize-package-data, @npmcli/package-json, bin-links, nopt, npmlog, parse-conflict-json, dezalgo, read
1111+
- ignore-walk, @npmcli/eslint-config, @npmcli/template-oss, npm-normalize-package-bin, @npmcli/name-from-folder, json-parse-even-better-errors, semver, @npmcli/move-file, fs-minipass, ssri, unique-slug, infer-owner, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/node-gyp, minipass-fetch, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, are-we-there-yet, gauge, wrappy, treeverse, minify-registry-metadata, @npmcli/disparity-colors, @npmcli/ci-detect, mute-stream, ini, npm-audit-report, npm-user-validate

docs/lib/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { join, dirname, basename, extname, sep, posix } = require('path')
2-
const fs = require('@npmcli/fs')
2+
const fs = require('fs/promises')
33
const ignoreWalk = require('ignore-walk')
44
const yaml = require('yaml')
55
const parseFrontMatter = require('front-matter')

docs/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
"dependencies": {
2323
"@isaacs/string-locale-compare": "^1.1.0",
2424
"@mdx-js/mdx": "^1.6.22",
25-
"@npmcli/fs": "^2.1.0",
2625
"cmark-gfm": "^0.9.0",
2726
"front-matter": "^4.0.2",
28-
"ignore-walk": "^5.0.1",
27+
"ignore-walk": "^6.0.0",
2928
"jsdom": "^20.0.1",
3029
"marked-man": "^0.7.0",
3130
"mkdirp": "^1.0.4",

lib/commands/completion.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// as an array.
3030
//
3131

32-
const fs = require('@npmcli/fs')
32+
const fs = require('fs/promises')
3333
const nopt = require('nopt')
3434

3535
const { definitions, shorthands } = require('../utils/config/index.js')

lib/npm.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { resolve, dirname, join } = require('path')
44
const Config = require('@npmcli/config')
55
const chalk = require('chalk')
66
const which = require('which')
7-
const fs = require('@npmcli/fs')
7+
const fs = require('fs/promises')
88

99
// Patch the global fs module here at the app level
1010
require('graceful-fs').gracefulify(require('fs'))
@@ -246,13 +246,13 @@ class Npm extends EventEmitter {
246246
// a cache dir, but we don't want to fail immediately since
247247
// the command might not need a cache dir (like `npm --version`)
248248
await this.time('npm:load:mkdirpcache', () =>
249-
fs.mkdir(this.cache, { recursive: true, owner: 'inherit' })
249+
fs.mkdir(this.cache, { recursive: true })
250250
.catch((e) => log.verbose('cache', `could not create cache: ${e}`)))
251251

252252
// its ok if this fails. user might have specified an invalid dir
253253
// which we will tell them about at the end
254254
await this.time('npm:load:mkdirplogs', () =>
255-
fs.mkdir(this.logsDir, { recursive: true, owner: 'inherit' })
255+
fs.mkdir(this.logsDir, { recursive: true })
256256
.catch((e) => log.verbose('logfile', `could not create logs-dir: ${e}`)))
257257

258258
// note: this MUST be shorter than the actual argv length, because it

lib/utils/exit-handler.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const os = require('os')
2-
const fs = require('@npmcli/fs')
2+
const fs = require('fs')
33

44
const log = require('./log-shim.js')
55
const errorMessage = require('./error-message.js')
@@ -186,11 +186,7 @@ const exitHandler = err => {
186186
file = `${npm.logPath}${file}`
187187
content = `'Log files:\n${npm.logFiles.join('\n')}\n\n${content.trim()}\n`
188188
try {
189-
fs.withOwnerSync(
190-
file,
191-
() => fs.writeFileSync(file, content),
192-
{ owner: 'inherit' }
193-
)
189+
fs.writeFileSync(file, content)
194190
detail.push(['', `\n\nFor a full report see:\n${file}`])
195191
} catch (err) {
196192
log.warn('', `Could not write error message to ${file} due to ${err}`)

lib/utils/log-file.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const rimraf = promisify(require('rimraf'))
55
const glob = promisify(require('glob'))
66
const MiniPass = require('minipass')
77
const fsMiniPass = require('fs-minipass')
8-
const fs = require('@npmcli/fs')
98
const log = require('./log-shim')
109

1110
const padZero = (n, length) => n.toString().padStart(length.toString().length, '0')
@@ -174,11 +173,7 @@ class LogFiles {
174173
// during process.on('exit') which has to be synchronous. So in order
175174
// to never drop log messages, it is easiest to make it sync all the time
176175
// and this was measured to be about 1.5% slower for 40k lines of output
177-
const logStream = fs.withOwnerSync(
178-
f,
179-
() => new fsMiniPass.WriteStreamSync(f, { flags: 'a' }),
180-
{ owner: 'inherit' }
181-
)
176+
const logStream = new fsMiniPass.WriteStreamSync(f, { flags: 'a' })
182177
if (count > 0) {
183178
// Reset file log count if we are opening
184179
// after our first file

lib/utils/timers.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const EE = require('events')
2-
const fs = require('@npmcli/fs')
2+
const fs = require('fs')
33
const log = require('./log-shim')
44

55
// This is an event emiiter but on/off
@@ -90,11 +90,7 @@ class Timers extends EE {
9090
return acc
9191
}, {}),
9292
}
93-
fs.withOwnerSync(
94-
this.file,
95-
() => fs.writeFileSync(this.file, JSON.stringify(content) + '\n'),
96-
{ owner: 'inherit' }
97-
)
93+
fs.writeFileSync(this.file, JSON.stringify(content) + '\n')
9894
} catch (e) {
9995
this.file = null
10096
log.warn('timing', `could not write timing file: ${e}`)

0 commit comments

Comments
 (0)