Skip to content

Commit dd90f9e

Browse files
committedOct 2, 2024
deps: update @npmcli/fs@4.0.0
1 parent 365580a commit dd90f9e

File tree

17 files changed

+894
-29
lines changed

17 files changed

+894
-29
lines changed
 

‎node_modules/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
!/binary-extensions
5656
!/brace-expansion
5757
!/cacache
58+
!/cacache/node_modules/
59+
/cacache/node_modules/*
60+
!/cacache/node_modules/@npmcli/
61+
/cacache/node_modules/@npmcli/*
62+
!/cacache/node_modules/@npmcli/fs
5863
!/chalk
5964
!/chownr
6065
!/ci-info

‎node_modules/@npmcli/fs/package.json

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@npmcli/fs",
3-
"version": "3.1.1",
3+
"version": "4.0.0",
44
"description": "filesystem utilities for the npm cli",
55
"main": "lib/index.js",
66
"files": [
@@ -11,12 +11,13 @@
1111
"snap": "tap",
1212
"test": "tap",
1313
"npmclilint": "npmcli-lint",
14-
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
15-
"lintfix": "npm run lint -- --fix",
14+
"lint": "npm run eslint",
15+
"lintfix": "npm run eslint -- --fix",
1616
"posttest": "npm run lint",
1717
"postsnap": "npm run lintfix --",
1818
"postlint": "template-oss-check",
19-
"template-oss-apply": "template-oss-apply --force"
19+
"template-oss-apply": "template-oss-apply --force",
20+
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
2021
},
2122
"repository": {
2223
"type": "git",
@@ -29,19 +30,20 @@
2930
"author": "GitHub Inc.",
3031
"license": "ISC",
3132
"devDependencies": {
32-
"@npmcli/eslint-config": "^4.0.0",
33-
"@npmcli/template-oss": "4.22.0",
33+
"@npmcli/eslint-config": "^5.0.0",
34+
"@npmcli/template-oss": "4.23.3",
3435
"tap": "^16.0.1"
3536
},
3637
"dependencies": {
3738
"semver": "^7.3.5"
3839
},
3940
"engines": {
40-
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
41+
"node": "^18.17.0 || >=20.5.0"
4142
},
4243
"templateOSS": {
4344
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
44-
"version": "4.22.0"
45+
"version": "4.23.3",
46+
"publish": true
4547
},
4648
"tap": {
4749
"nyc-arg": [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!-- This file is automatically added by @npmcli/template-oss. Do not edit. -->
2+
3+
ISC License
4+
5+
Copyright npm, Inc.
6+
7+
Permission to use, copy, modify, and/or distribute this
8+
software for any purpose with or without fee is hereby
9+
granted, provided that the above copyright notice and this
10+
permission notice appear in all copies.
11+
12+
THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
13+
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
14+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
15+
EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
16+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18+
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
20+
USE OR PERFORMANCE OF THIS SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// given an input that may or may not be an object, return an object that has
2+
// a copy of every defined property listed in 'copy'. if the input is not an
3+
// object, assign it to the property named by 'wrap'
4+
const getOptions = (input, { copy, wrap }) => {
5+
const result = {}
6+
7+
if (input && typeof input === 'object') {
8+
for (const prop of copy) {
9+
if (input[prop] !== undefined) {
10+
result[prop] = input[prop]
11+
}
12+
}
13+
} else {
14+
result[wrap] = input
15+
}
16+
17+
return result
18+
}
19+
20+
module.exports = getOptions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const semver = require('semver')
2+
3+
const satisfies = (range) => {
4+
return semver.satisfies(process.version, range, { includePrerelease: true })
5+
}
6+
7+
module.exports = {
8+
satisfies,
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(The MIT License)
2+
3+
Copyright (c) 2011-2017 JP Richardson
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
6+
(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
7+
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11+
12+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
14+
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
15+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
'use strict'
2+
const { inspect } = require('util')
3+
4+
// adapted from node's internal/errors
5+
// https://github.com/nodejs/node/blob/c8a04049/lib/internal/errors.js
6+
7+
// close copy of node's internal SystemError class.
8+
class SystemError {
9+
constructor (code, prefix, context) {
10+
// XXX context.code is undefined in all constructors used in cp/polyfill
11+
// that may be a bug copied from node, maybe the constructor should use
12+
// `code` not `errno`? nodejs/node#41104
13+
let message = `${prefix}: ${context.syscall} returned ` +
14+
`${context.code} (${context.message})`
15+
16+
if (context.path !== undefined) {
17+
message += ` ${context.path}`
18+
}
19+
if (context.dest !== undefined) {
20+
message += ` => ${context.dest}`
21+
}
22+
23+
this.code = code
24+
Object.defineProperties(this, {
25+
name: {
26+
value: 'SystemError',
27+
enumerable: false,
28+
writable: true,
29+
configurable: true,
30+
},
31+
message: {
32+
value: message,
33+
enumerable: false,
34+
writable: true,
35+
configurable: true,
36+
},
37+
info: {
38+
value: context,
39+
enumerable: true,
40+
configurable: true,
41+
writable: false,
42+
},
43+
errno: {
44+
get () {
45+
return context.errno
46+
},
47+
set (value) {
48+
context.errno = value
49+
},
50+
enumerable: true,
51+
configurable: true,
52+
},
53+
syscall: {
54+
get () {
55+
return context.syscall
56+
},
57+
set (value) {
58+
context.syscall = value
59+
},
60+
enumerable: true,
61+
configurable: true,
62+
},
63+
})
64+
65+
if (context.path !== undefined) {
66+
Object.defineProperty(this, 'path', {
67+
get () {
68+
return context.path
69+
},
70+
set (value) {
71+
context.path = value
72+
},
73+
enumerable: true,
74+
configurable: true,
75+
})
76+
}
77+
78+
if (context.dest !== undefined) {
79+
Object.defineProperty(this, 'dest', {
80+
get () {
81+
return context.dest
82+
},
83+
set (value) {
84+
context.dest = value
85+
},
86+
enumerable: true,
87+
configurable: true,
88+
})
89+
}
90+
}
91+
92+
toString () {
93+
return `${this.name} [${this.code}]: ${this.message}`
94+
}
95+
96+
[Symbol.for('nodejs.util.inspect.custom')] (_recurseTimes, ctx) {
97+
return inspect(this, {
98+
...ctx,
99+
getters: true,
100+
customInspect: false,
101+
})
102+
}
103+
}
104+
105+
function E (code, message) {
106+
module.exports[code] = class NodeError extends SystemError {
107+
constructor (ctx) {
108+
super(code, message, ctx)
109+
}
110+
}
111+
}
112+
113+
E('ERR_FS_CP_DIR_TO_NON_DIR', 'Cannot overwrite directory with non-directory')
114+
E('ERR_FS_CP_EEXIST', 'Target already exists')
115+
E('ERR_FS_CP_EINVAL', 'Invalid src or dest')
116+
E('ERR_FS_CP_FIFO_PIPE', 'Cannot copy a FIFO pipe')
117+
E('ERR_FS_CP_NON_DIR_TO_DIR', 'Cannot overwrite non-directory with directory')
118+
E('ERR_FS_CP_SOCKET', 'Cannot copy a socket file')
119+
E('ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY', 'Cannot overwrite symlink in subdirectory of self')
120+
E('ERR_FS_CP_UNKNOWN', 'Cannot copy an unknown file type')
121+
E('ERR_FS_EISDIR', 'Path is a directory')
122+
123+
module.exports.ERR_INVALID_ARG_TYPE = class ERR_INVALID_ARG_TYPE extends Error {
124+
constructor (name, expected, actual) {
125+
super()
126+
this.code = 'ERR_INVALID_ARG_TYPE'
127+
this.message = `The ${name} argument must be ${expected}. Received ${typeof actual}`
128+
}
129+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const fs = require('fs/promises')
2+
const getOptions = require('../common/get-options.js')
3+
const node = require('../common/node.js')
4+
const polyfill = require('./polyfill.js')
5+
6+
// node 16.7.0 added fs.cp
7+
const useNative = node.satisfies('>=16.7.0')
8+
9+
const cp = async (src, dest, opts) => {
10+
const options = getOptions(opts, {
11+
copy: ['dereference', 'errorOnExist', 'filter', 'force', 'preserveTimestamps', 'recursive'],
12+
})
13+
14+
// the polyfill is tested separately from this module, no need to hack
15+
// process.version to try to trigger it just for coverage
16+
// istanbul ignore next
17+
return useNative
18+
? fs.cp(src, dest, options)
19+
: polyfill(src, dest, options)
20+
}
21+
22+
module.exports = cp

‎node_modules/cacache/node_modules/@npmcli/fs/lib/cp/polyfill.js

+428
Large diffs are not rendered by default.

‎node_modules/cacache/node_modules/@npmcli/fs/lib/index.js

+13
Original file line numberDiff line numberDiff line change

‎node_modules/cacache/node_modules/@npmcli/fs/lib/move-file.js

+78
Original file line numberDiff line numberDiff line change

‎node_modules/cacache/node_modules/@npmcli/fs/lib/readdir-scoped.js

+20
Original file line numberDiff line numberDiff line change

‎node_modules/cacache/node_modules/@npmcli/fs/lib/with-temp-dir.js

+39
Original file line numberDiff line numberDiff line change

‎node_modules/cacache/node_modules/@npmcli/fs/package.json

+52
Original file line numberDiff line numberDiff line change

‎package-lock.json

+32-19
Original file line numberDiff line numberDiff line change

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"@isaacs/string-locale-compare": "^1.1.0",
5555
"@npmcli/arborist": "^7.5.4",
5656
"@npmcli/config": "^8.3.4",
57-
"@npmcli/fs": "^3.1.1",
57+
"@npmcli/fs": "^4.0.0",
5858
"@npmcli/map-workspaces": "^3.0.6",
5959
"@npmcli/package-json": "^5.2.0",
6060
"@npmcli/promise-spawn": "^7.0.2",

‎workspaces/arborist/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Manage node_modules trees",
55
"dependencies": {
66
"@isaacs/string-locale-compare": "^1.1.0",
7-
"@npmcli/fs": "^3.1.1",
7+
"@npmcli/fs": "^4.0.0",
88
"@npmcli/installed-package-contents": "^2.1.0",
99
"@npmcli/map-workspaces": "^3.0.2",
1010
"@npmcli/metavuln-calculator": "^7.1.1",

0 commit comments

Comments
 (0)
Please sign in to comment.