From 2ef9f9847c11fe8c0c0494558fe77c15ac4dbc80 Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 20 Jan 2022 12:38:14 -0800 Subject: [PATCH] deps: bin-links@3.0.0 write-file-atomic@4.0.0 (#4254) * deps: bin-links@3.0.0 * deps: write-file-atomic@4.0.0 --- node_modules/bin-links/lib/bin-target.js | 8 +- node_modules/bin-links/lib/check-bin.js | 47 ++++--- node_modules/bin-links/lib/check-bins.js | 8 +- .../bin-links/lib/get-node-modules.js | 5 +- node_modules/bin-links/lib/get-paths.js | 17 ++- node_modules/bin-links/lib/get-prefix.js | 2 +- node_modules/bin-links/{ => lib}/index.js | 19 +-- node_modules/bin-links/lib/link-bin.js | 4 +- node_modules/bin-links/lib/link-bins.js | 9 +- node_modules/bin-links/lib/link-gently.js | 47 ++++--- node_modules/bin-links/lib/link-mans.js | 9 +- node_modules/bin-links/lib/man-target.js | 4 +- node_modules/bin-links/lib/shim-bin.js | 42 +++--- node_modules/bin-links/package.json | 28 ++-- node_modules/typedarray-to-buffer/.airtap.yml | 15 --- node_modules/typedarray-to-buffer/index.js | 19 +-- .../typedarray-to-buffer/package.json | 28 ++-- .../typedarray-to-buffer/test/basic.js | 50 ------- .../write-file-atomic/{LICENSE => LICENSE.md} | 0 .../write-file-atomic/{ => lib}/index.js | 19 ++- node_modules/write-file-atomic/package.json | 36 ++--- package-lock.json | 125 +++++++++++++----- package.json | 2 +- workspaces/arborist/package.json | 2 +- workspaces/libnpmexec/package.json | 2 +- 25 files changed, 298 insertions(+), 249 deletions(-) rename node_modules/bin-links/{ => lib}/index.js (70%) delete mode 100644 node_modules/typedarray-to-buffer/.airtap.yml delete mode 100644 node_modules/typedarray-to-buffer/test/basic.js rename node_modules/write-file-atomic/{LICENSE => LICENSE.md} (100%) rename node_modules/write-file-atomic/{ => lib}/index.js (94%) diff --git a/node_modules/bin-links/lib/bin-target.js b/node_modules/bin-links/lib/bin-target.js index 7ea0c2a96ed68..0629285d5144c 100644 --- a/node_modules/bin-links/lib/bin-target.js +++ b/node_modules/bin-links/lib/bin-target.js @@ -1,9 +1,9 @@ const isWindows = require('./is-windows.js') const getPrefix = require('./get-prefix.js') const getNodeModules = require('./get-node-modules.js') -const {dirname} = require('path') +const { dirname } = require('path') -module.exports = ({top, path}) => +module.exports = ({ top, path }) => !top ? getNodeModules(path) + '/.bin' - : isWindows ? getPrefix(path) - : dirname(getPrefix(path)) + '/bin' + : isWindows ? getPrefix(path) + : dirname(getPrefix(path)) + '/bin' diff --git a/node_modules/bin-links/lib/check-bin.js b/node_modules/bin-links/lib/check-bin.js index 45eec8affc92a..8bbe45188a479 100644 --- a/node_modules/bin-links/lib/check-bin.js +++ b/node_modules/bin-links/lib/check-bin.js @@ -2,53 +2,56 @@ // either rejects or resolves to nothing. return value not relevant. const isWindows = require('./is-windows.js') const binTarget = require('./bin-target.js') -const {resolve, dirname} = require('path') +const { resolve, dirname } = require('path') const readCmdShim = require('read-cmd-shim') const fs = require('fs') -const {promisify} = require('util') +const { promisify } = require('util') const readlink = promisify(fs.readlink) -const checkBin = async ({bin, path, top, global, force}) => { +const checkBin = async ({ bin, path, top, global, force }) => { // always ok to clobber when forced // always ok to clobber local bins, or when forced - if (force || !global || !top) + if (force || !global || !top) { return + } // ok, need to make sure, then - const target = resolve(binTarget({path, top}), bin) + const target = resolve(binTarget({ path, top }), bin) path = resolve(path) - return isWindows ? checkShim({target, path}) : checkLink({target, path}) + return isWindows ? checkShim({ target, path }) : checkLink({ target, path }) } // only enoent is allowed. anything else is a problem. -const handleReadLinkError = async ({er, target}) => +const handleReadLinkError = async ({ er, target }) => er.code === 'ENOENT' ? null - : failEEXIST({target}) + : failEEXIST({ target }) -const checkLink = async ({target, path}) => { +const checkLink = async ({ target, path }) => { const current = await readlink(target) - .catch(er => handleReadLinkError({er, target})) + .catch(er => handleReadLinkError({ er, target })) - if (!current) + if (!current) { return + } const resolved = resolve(dirname(target), current) - if (resolved.toLowerCase().indexOf(path.toLowerCase()) !== 0) - return failEEXIST({target}) + if (resolved.toLowerCase().indexOf(path.toLowerCase()) !== 0) { + return failEEXIST({ target }) + } } -const handleReadCmdShimError = ({er, target}) => +const handleReadCmdShimError = ({ er, target }) => er.code === 'ENOENT' ? null - : failEEXIST({target}) + : failEEXIST({ target }) -const failEEXIST = ({target}) => +const failEEXIST = ({ target }) => Promise.reject(Object.assign(new Error('EEXIST: file already exists'), { path: target, code: 'EEXIST', })) -const checkShim = async ({target, path}) => { +const checkShim = async ({ target, path }) => { const shims = [ target, target + '.cmd', @@ -56,15 +59,17 @@ const checkShim = async ({target, path}) => { ] await Promise.all(shims.map(async target => { const current = await readCmdShim(target) - .catch(er => handleReadCmdShimError({er, target})) + .catch(er => handleReadCmdShimError({ er, target })) - if (!current) + if (!current) { return + } const resolved = resolve(dirname(target), current.replace(/\\/g, '/')) - if (resolved.toLowerCase().indexOf(path.toLowerCase()) !== 0) - return failEEXIST({target}) + if (resolved.toLowerCase().indexOf(path.toLowerCase()) !== 0) { + return failEEXIST({ target }) + } })) } diff --git a/node_modules/bin-links/lib/check-bins.js b/node_modules/bin-links/lib/check-bins.js index 0addbffe55abb..76a683c91d7c2 100644 --- a/node_modules/bin-links/lib/check-bins.js +++ b/node_modules/bin-links/lib/check-bins.js @@ -3,14 +3,16 @@ const normalize = require('npm-normalize-package-bin') const checkBins = async ({ pkg, path, top, global, force }) => { // always ok to clobber when forced // always ok to clobber local bins, or when forced - if (force || !global || !top) + if (force || !global || !top) { return + } pkg = normalize(pkg) - if (!pkg.bin) + if (!pkg.bin) { return + } await Promise.all(Object.keys(pkg.bin) - .map(bin => checkBin({bin, path, top, global, force}))) + .map(bin => checkBin({ bin, path, top, global, force }))) } module.exports = checkBins diff --git a/node_modules/bin-links/lib/get-node-modules.js b/node_modules/bin-links/lib/get-node-modules.js index b67c198eff348..5c16b3b8afbfb 100644 --- a/node_modules/bin-links/lib/get-node-modules.js +++ b/node_modules/bin-links/lib/get-node-modules.js @@ -2,12 +2,13 @@ // {prefix}/node_modules/{name}. Can't rely on pkg.name, because // it might be installed as an alias. -const {dirname, basename} = require('path') +const { dirname, basename } = require('path') // this gets called a lot and can't change, so memoize it const memo = new Map() module.exports = path => { - if (memo.has(path)) + if (memo.has(path)) { return memo.get(path) + } const scopeOrNm = dirname(path) const nm = basename(scopeOrNm) === 'node_modules' ? scopeOrNm diff --git a/node_modules/bin-links/lib/get-paths.js b/node_modules/bin-links/lib/get-paths.js index 614c85652a1aa..631aef9f9117f 100644 --- a/node_modules/bin-links/lib/get-paths.js +++ b/node_modules/bin-links/lib/get-paths.js @@ -3,14 +3,15 @@ // are present, then we can assume that they're associated. const binTarget = require('./bin-target.js') const manTarget = require('./man-target.js') -const {resolve, basename} = require('path') +const { resolve, basename } = require('path') const isWindows = require('./is-windows.js') -module.exports = ({path, pkg, global, top}) => { - if (top && !global) +module.exports = ({ path, pkg, global, top }) => { + if (top && !global) { return [] + } const binSet = [] - const binTarg = binTarget({path, top}) + const binTarg = binTarget({ path, top }) if (pkg.bin) { for (const bin of Object.keys(pkg.bin)) { const b = resolve(binTarg, bin) @@ -22,14 +23,15 @@ module.exports = ({path, pkg, global, top}) => { } } - const manTarg = manTarget({path, top}) + const manTarg = manTarget({ path, top }) const manSet = [] if (manTarg && pkg.man && Array.isArray(pkg.man) && pkg.man.length) { for (const man of pkg.man) { const parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/) // invalid entries invalidate the entire man set - if (!parseMan) + if (!parseMan) { return binSet + } const stem = parseMan[1] const sxn = parseMan[2] @@ -37,8 +39,9 @@ module.exports = ({path, pkg, global, top}) => { const absFrom = resolve(path, man) /* istanbul ignore if - should be impossible */ - if (absFrom.indexOf(path) !== 0) + if (absFrom.indexOf(path) !== 0) { return binSet + } manSet.push(resolve(manTarg, 'man' + sxn, base)) } diff --git a/node_modules/bin-links/lib/get-prefix.js b/node_modules/bin-links/lib/get-prefix.js index 96112bf0a2b97..d5cf9c9d01c20 100644 --- a/node_modules/bin-links/lib/get-prefix.js +++ b/node_modules/bin-links/lib/get-prefix.js @@ -1,3 +1,3 @@ -const {dirname} = require('path') +const { dirname } = require('path') const getNodeModules = require('./get-node-modules.js') module.exports = path => dirname(getNodeModules(path)) diff --git a/node_modules/bin-links/index.js b/node_modules/bin-links/lib/index.js similarity index 70% rename from node_modules/bin-links/index.js rename to node_modules/bin-links/lib/index.js index 2e8519737220a..ab3bd13c0be6b 100644 --- a/node_modules/bin-links/index.js +++ b/node_modules/bin-links/lib/index.js @@ -1,5 +1,5 @@ -const linkBins = require('./lib/link-bins.js') -const linkMans = require('./lib/link-mans.js') +const linkBins = require('./link-bins.js') +const linkMans = require('./link-mans.js') const binLinks = opts => { const { path, pkg, force, global, top } = opts @@ -14,27 +14,28 @@ const binLinks = opts => { // non-global top pkgs don't have any bins or mans linked. From here on // out, if it's top, we know that it's global, so no need to pass that // option further down the stack. - if (top && !global) + if (top && !global) { return Promise.resolve() + } return Promise.all([ // allow clobbering within the local node_modules/.bin folder. // only global bins are protected in this way, or else it is // yet another vector for excessive dependency conflicts. - linkBins({path, pkg, top, force: force || !top}), - linkMans({path, pkg, top, force}), + linkBins({ path, pkg, top, force: force || !top }), + linkMans({ path, pkg, top, force }), ]) } -const shimBin = require('./lib/shim-bin.js') -const linkGently = require('./lib/link-gently.js') +const shimBin = require('./shim-bin.js') +const linkGently = require('./link-gently.js') const resetSeen = () => { shimBin.resetSeen() linkGently.resetSeen() } -const checkBins = require('./lib/check-bins.js') -const getPaths = require('./lib/get-paths.js') +const checkBins = require('./check-bins.js') +const getPaths = require('./get-paths.js') module.exports = Object.assign(binLinks, { checkBins, diff --git a/node_modules/bin-links/lib/link-bin.js b/node_modules/bin-links/lib/link-bin.js index 4c0bde489348a..fb579350994d0 100644 --- a/node_modules/bin-links/lib/link-bin.js +++ b/node_modules/bin-links/lib/link-bin.js @@ -2,8 +2,8 @@ const linkGently = require('./link-gently.js') const fixBin = require('./fix-bin.js') // linking bins is simple. just symlink, and if we linked it, fix the bin up -const linkBin = ({path, to, from, absFrom, force}) => - linkGently({path, to, from, absFrom, force}) +const linkBin = ({ path, to, from, absFrom, force }) => + linkGently({ path, to, from, absFrom, force }) .then(linked => linked && fixBin(absFrom)) module.exports = linkBin diff --git a/node_modules/bin-links/lib/link-bins.js b/node_modules/bin-links/lib/link-bins.js index 6a1086b92b264..9bf7d72117fbb 100644 --- a/node_modules/bin-links/lib/link-bins.js +++ b/node_modules/bin-links/lib/link-bins.js @@ -4,17 +4,18 @@ const { dirname, resolve, relative } = require('path') const linkBin = isWindows ? require('./shim-bin.js') : require('./link-bin.js') const normalize = require('npm-normalize-package-bin') -const linkBins = ({path, pkg, top, force}) => { +const linkBins = ({ path, pkg, top, force }) => { pkg = normalize(pkg) - if (!pkg.bin) + if (!pkg.bin) { return Promise.resolve([]) + } const promises = [] - const target = binTarget({path, top}) + const target = binTarget({ path, top }) for (const [key, val] of Object.entries(pkg.bin)) { const to = resolve(target, key) const absFrom = resolve(path, val) const from = relative(dirname(to), absFrom) - promises.push(linkBin({path, from, to, absFrom, force})) + promises.push(linkBin({ path, from, to, absFrom, force })) } return Promise.all(promises) } diff --git a/node_modules/bin-links/lib/link-gently.js b/node_modules/bin-links/lib/link-gently.js index 6a6e555de7cf5..671ce38a586e7 100644 --- a/node_modules/bin-links/lib/link-gently.js +++ b/node_modules/bin-links/lib/link-gently.js @@ -11,7 +11,11 @@ const fs = require('fs') const symlink = promisify(fs.symlink) const readlink = promisify(fs.readlink) const lstat = promisify(fs.lstat) -const throwNonEnoent = er => { if (er.code !== 'ENOENT') throw er } +const throwNonEnoent = er => { + if (er.code !== 'ENOENT') { + throw er + } +} // even in --force mode, we never create a link over a link we've // already created. you can have multiple packages in a tree trying @@ -24,11 +28,12 @@ const rimraf = promisify(require('rimraf')) const rm = path => rimraf(path, { glob: false }) const SKIP = Symbol('skip - missing or already installed') -const CLOBBER = Symbol('clobber - ours or in forceful mode') +const CLOBBER = Symbol('clobber - ours or in forceful mode') -const linkGently = async ({path, to, from, absFrom, force}) => { - if (seen.has(to)) +const linkGently = async ({ path, to, from, absFrom, force }) => { + if (seen.has(to)) { return true + } seen.add(to) // if the script or manpage isn't there, just ignore it. @@ -40,36 +45,42 @@ const linkGently = async ({path, to, from, absFrom, force}) => { lstat(to).catch(throwNonEnoent), ]).then(([stFrom, stTo]) => { // not present in package, skip it - if (!stFrom) + if (!stFrom) { return SKIP + } // exists! maybe clobber if we can if (stTo) { - if (!stTo.isSymbolicLink()) + if (!stTo.isSymbolicLink()) { return force && rm(to).then(() => CLOBBER) + } return readlink(to).then(target => { - if (target === from) - return SKIP // skip it, already set up like we want it. + if (target === from) { + return SKIP + } // skip it, already set up like we want it. target = resolve(dirname(to), target) - if (target.indexOf(path) === 0 || force) + if (target.indexOf(path) === 0 || force) { return rm(to).then(() => CLOBBER) + } }) } else { // doesn't exist, dir might not either return mkdirp(dirname(to)) } }) - .then(skipOrClobber => { - if (skipOrClobber === SKIP) - return false - return symlink(from, to, 'file').catch(er => { - if (skipOrClobber === CLOBBER || force) - return rm(to).then(() => symlink(from, to, 'file')) - throw er - }).then(() => true) - }) + .then(skipOrClobber => { + if (skipOrClobber === SKIP) { + return false + } + return symlink(from, to, 'file').catch(er => { + if (skipOrClobber === CLOBBER || force) { + return rm(to).then(() => symlink(from, to, 'file')) + } + throw er + }).then(() => true) + }) } const resetSeen = () => { diff --git a/node_modules/bin-links/lib/link-mans.js b/node_modules/bin-links/lib/link-mans.js index 6fb167e480a74..54b17d1fc16d4 100644 --- a/node_modules/bin-links/lib/link-mans.js +++ b/node_modules/bin-links/lib/link-mans.js @@ -2,10 +2,11 @@ const { dirname, relative, join, resolve, basename } = require('path') const linkGently = require('./link-gently.js') const manTarget = require('./man-target.js') -const linkMans = ({path, pkg, top, force}) => { - const target = manTarget({path, top}) - if (!target || !pkg.man || !Array.isArray(pkg.man) || !pkg.man.length) +const linkMans = ({ path, pkg, top, force }) => { + const target = manTarget({ path, top }) + if (!target || !pkg.man || !Array.isArray(pkg.man) || !pkg.man.length) { return Promise.resolve([]) + } // break any links to c:\\blah or /foo/blah or ../blah // and filter out duplicates @@ -44,7 +45,7 @@ const linkMans = ({path, pkg, top, force}) => { const to = resolve(target, 'man' + sxn, base) const from = relative(dirname(to), absFrom) - return linkGently({from, to, path, absFrom, force}) + return linkGently({ from, to, path, absFrom, force }) })) } diff --git a/node_modules/bin-links/lib/man-target.js b/node_modules/bin-links/lib/man-target.js index 832d2ea35e43c..efe66f38a5543 100644 --- a/node_modules/bin-links/lib/man-target.js +++ b/node_modules/bin-links/lib/man-target.js @@ -1,6 +1,6 @@ const isWindows = require('./is-windows.js') const getPrefix = require('./get-prefix.js') -const {dirname} = require('path') +const { dirname } = require('path') -module.exports = ({top, path}) => !top || isWindows ? null +module.exports = ({ top, path }) => !top || isWindows ? null : dirname(getPrefix(path)) + '/share/man' diff --git a/node_modules/bin-links/lib/shim-bin.js b/node_modules/bin-links/lib/shim-bin.js index f2dfd7a7825d1..70259a49e5b0c 100644 --- a/node_modules/bin-links/lib/shim-bin.js +++ b/node_modules/bin-links/lib/shim-bin.js @@ -2,7 +2,11 @@ const { promisify } = require('util') const { resolve, dirname } = require('path') const fs = require('fs') const lstat = promisify(fs.lstat) -const throwNonEnoent = er => { if (er.code !== 'ENOENT') throw er } +const throwNonEnoent = er => { + if (er.code !== 'ENOENT') { + throw er + } +} const cmdShim = require('cmd-shim') const readCmdShim = require('read-cmd-shim') @@ -15,20 +19,20 @@ const fixBin = require('./fix-bin.js') // nondeterminism. const seen = new Set() -const failEEXIST = ({path, to, from}) => +const failEEXIST = ({ path, to, from }) => Promise.reject(Object.assign(new Error('EEXIST: file already exists'), { path: to, dest: from, code: 'EEXIST', })) -const handleReadCmdShimError = ({er, from, to}) => +const handleReadCmdShimError = ({ er, from, to }) => er.code === 'ENOENT' ? null - : er.code === 'ENOTASHIM' ? failEEXIST({from, to}) + : er.code === 'ENOTASHIM' ? failEEXIST({ from, to }) : Promise.reject(er) const SKIP = Symbol('skip - missing or already installed') -const shimBin = ({path, to, from, absFrom, force}) => { +const shimBin = ({ path, to, from, absFrom, force }) => { const shims = [ to, to + '.cmd', @@ -36,8 +40,9 @@ const shimBin = ({path, to, from, absFrom, force}) => { ] for (const shim of shims) { - if (seen.has(shim)) + if (seen.has(shim)) { return true + } seen.add(shim) } @@ -45,30 +50,29 @@ const shimBin = ({path, to, from, absFrom, force}) => { ...shims, absFrom, ].map(f => lstat(f).catch(throwNonEnoent))).then((stats) => { - const [ - stToBase, - stToCmd, - stToPs1, - stFrom, - ] = stats - if (!stFrom) + const [, , , stFrom] = stats + if (!stFrom) { return SKIP + } - if (force) + if (force) { return + } return Promise.all(shims.map((s, i) => [s, stats[i]]).map(([s, st]) => { - if (!st) + if (!st) { return + } return readCmdShim(s) .then(target => { target = resolve(dirname(to), target) - if (target.indexOf(resolve(path)) !== 0) - return failEEXIST({from, to, path}) - }, er => handleReadCmdShimError({er, from, to})) + if (target.indexOf(resolve(path)) !== 0) { + return failEEXIST({ from, to, path }) + } + }, er => handleReadCmdShimError({ er, from, to })) })) }) - .then(skip => skip !== SKIP && doShim(absFrom, to)) + .then(skip => skip !== SKIP && doShim(absFrom, to)) } const doShim = (absFrom, to) => diff --git a/node_modules/bin-links/package.json b/node_modules/bin-links/package.json index 8293d77d1a85a..0325ab4437656 100644 --- a/node_modules/bin-links/package.json +++ b/node_modules/bin-links/package.json @@ -1,14 +1,18 @@ { "name": "bin-links", - "version": "2.3.0", + "version": "3.0.0", "description": "JavaScript package binary linker", - "main": "index.js", + "main": "./lib/index.js", "scripts": { - "preversion": "npm t", + "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push --follow-tags", + "prepublishOnly": "git push origin --follow-tags", "snap": "tap", - "test": "tap" + "test": "tap", + "lint": "eslint '**/*.js'", + "postlint": "npm-template-check", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint" }, "repository": { "type": "git", @@ -26,9 +30,10 @@ "npm-normalize-package-bin": "^1.0.0", "read-cmd-shim": "^2.0.0", "rimraf": "^3.0.0", - "write-file-atomic": "^3.0.3" + "write-file-atomic": "^4.0.0" }, "devDependencies": { + "@npmcli/template-oss": "^2.5.0", "mkdirp": "^1.0.3", "require-inject": "^1.4.4", "tap": "^15.0.10" @@ -38,10 +43,15 @@ "coverage-map": "map.js" }, "files": [ - "index.js", - "lib/*.js" + "bin", + "lib" ], "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "author": "GitHub Inc.", + "templateOSS": { + "windowsCI": false, + "version": "2.5.0" } } diff --git a/node_modules/typedarray-to-buffer/.airtap.yml b/node_modules/typedarray-to-buffer/.airtap.yml deleted file mode 100644 index 3417780255e8e..0000000000000 --- a/node_modules/typedarray-to-buffer/.airtap.yml +++ /dev/null @@ -1,15 +0,0 @@ -sauce_connect: true -loopback: airtap.local -browsers: - - name: chrome - version: latest - - name: firefox - version: latest - - name: safari - version: latest - - name: microsoftedge - version: latest - - name: ie - version: latest - - name: iphone - version: latest diff --git a/node_modules/typedarray-to-buffer/index.js b/node_modules/typedarray-to-buffer/index.js index 5fa394dd201d2..fd1e192b2656b 100644 --- a/node_modules/typedarray-to-buffer/index.js +++ b/node_modules/typedarray-to-buffer/index.js @@ -1,3 +1,4 @@ +/*! typedarray-to-buffer. MIT License. Feross Aboukhadijeh */ /** * Convert a typed array to a Buffer without a copy * @@ -7,19 +8,11 @@ * `npm install typedarray-to-buffer` */ -var isTypedArray = require('is-typedarray').strict - module.exports = function typedarrayToBuffer (arr) { - if (isTypedArray(arr)) { - // To avoid a copy, use the typed array's underlying ArrayBuffer to back new Buffer - var buf = Buffer.from(arr.buffer) - if (arr.byteLength !== arr.buffer.byteLength) { - // Respect the "view", i.e. byteOffset and byteLength, without doing a copy - buf = buf.slice(arr.byteOffset, arr.byteOffset + arr.byteLength) - } - return buf - } else { + return ArrayBuffer.isView(arr) + // To avoid a copy, use the typed array's underlying ArrayBuffer to back + // new Buffer, respecting the "view", i.e. byteOffset and byteLength + ? Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength) // Pass through all other types to `Buffer.from` - return Buffer.from(arr) - } + : Buffer.from(arr) } diff --git a/node_modules/typedarray-to-buffer/package.json b/node_modules/typedarray-to-buffer/package.json index 5ec5656157991..502a322c6d746 100644 --- a/node_modules/typedarray-to-buffer/package.json +++ b/node_modules/typedarray-to-buffer/package.json @@ -1,22 +1,20 @@ { "name": "typedarray-to-buffer", "description": "Convert a typed array to a Buffer without a copy", - "version": "3.1.5", + "version": "4.0.0", "author": { "name": "Feross Aboukhadijeh", "email": "feross@feross.org", - "url": "http://feross.org/" + "url": "https://feross.org" }, "bugs": { "url": "https://github.com/feross/typedarray-to-buffer/issues" }, - "dependencies": { - "is-typedarray": "^1.0.0" - }, + "dependencies": {}, "devDependencies": { - "airtap": "0.0.4", + "airtap": "^3.0.0", "standard": "*", - "tape": "^4.0.0" + "tape": "^5.0.1" }, "homepage": "http://feross.org", "keywords": [ @@ -46,5 +44,19 @@ "test-browser": "airtap -- test/*.js", "test-browser-local": "airtap --local -- test/*.js", "test-node": "tape test/*.js" - } + }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] } diff --git a/node_modules/typedarray-to-buffer/test/basic.js b/node_modules/typedarray-to-buffer/test/basic.js deleted file mode 100644 index 352109682f5c1..0000000000000 --- a/node_modules/typedarray-to-buffer/test/basic.js +++ /dev/null @@ -1,50 +0,0 @@ -var test = require('tape') -var toBuffer = require('../') - -test('convert to buffer from Uint8Array', function (t) { - if (typeof Uint8Array !== 'undefined') { - var arr = new Uint8Array([1, 2, 3]) - arr = toBuffer(arr) - - t.deepEqual(arr, Buffer.from([1, 2, 3]), 'contents equal') - t.ok(Buffer.isBuffer(arr), 'is buffer') - t.equal(arr.readUInt8(0), 1) - t.equal(arr.readUInt8(1), 2) - t.equal(arr.readUInt8(2), 3) - } else { - t.pass('browser lacks Uint8Array support, skip test') - } - t.end() -}) - -test('convert to buffer from another arrayview type (Uint32Array)', function (t) { - if (typeof Uint32Array !== 'undefined' && Buffer.TYPED_ARRAY_SUPPORT !== false) { - var arr = new Uint32Array([1, 2, 3]) - arr = toBuffer(arr) - - t.deepEqual(arr, Buffer.from([1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0]), 'contents equal') - t.ok(Buffer.isBuffer(arr), 'is buffer') - t.equal(arr.readUInt32LE(0), 1) - t.equal(arr.readUInt32LE(4), 2) - t.equal(arr.readUInt32LE(8), 3) - t.equal(arr instanceof Uint8Array, true) - } else { - t.pass('browser lacks Uint32Array support, skip test') - } - t.end() -}) - -test('convert to buffer from ArrayBuffer', function (t) { - if (typeof Uint32Array !== 'undefined' && Buffer.TYPED_ARRAY_SUPPORT !== false) { - var arr = new Uint32Array([1, 2, 3]).subarray(1, 2) - arr = toBuffer(arr) - - t.deepEqual(arr, Buffer.from([2, 0, 0, 0]), 'contents equal') - t.ok(Buffer.isBuffer(arr), 'is buffer') - t.equal(arr.readUInt32LE(0), 2) - t.equal(arr instanceof Uint8Array, true) - } else { - t.pass('browser lacks ArrayBuffer support, skip test') - } - t.end() -}) diff --git a/node_modules/write-file-atomic/LICENSE b/node_modules/write-file-atomic/LICENSE.md similarity index 100% rename from node_modules/write-file-atomic/LICENSE rename to node_modules/write-file-atomic/LICENSE.md diff --git a/node_modules/write-file-atomic/index.js b/node_modules/write-file-atomic/lib/index.js similarity index 94% rename from node_modules/write-file-atomic/index.js rename to node_modules/write-file-atomic/lib/index.js index df5b72a14f74a..9a7d183aecb4c 100644 --- a/node_modules/write-file-atomic/index.js +++ b/node_modules/write-file-atomic/lib/index.js @@ -48,10 +48,14 @@ function cleanupOnExit (tmpfile) { function serializeActiveFile (absoluteName) { return new Promise(resolve => { // make a queue if it doesn't already exist - if (!activeFiles[absoluteName]) activeFiles[absoluteName] = [] + if (!activeFiles[absoluteName]) { + activeFiles[absoluteName] = [] + } activeFiles[absoluteName].push(resolve) // add this job to the queue - if (activeFiles[absoluteName].length === 1) resolve() // kick off the first one + if (activeFiles[absoluteName].length === 1) { + resolve() + } // kick off the first one }) } @@ -151,7 +155,9 @@ async function writeFileAsync (filename, data, options = {}) { activeFiles[absoluteName].shift() // remove the element added by serializeSameFile if (activeFiles[absoluteName].length > 0) { activeFiles[absoluteName][0]() // start next job if one is pending - } else delete activeFiles[absoluteName] + } else { + delete activeFiles[absoluteName] + } } } @@ -170,8 +176,11 @@ function writeFile (filename, data, options, callback) { } function writeFileSync (filename, data, options) { - if (typeof options === 'string') options = { encoding: options } - else if (!options) options = {} + if (typeof options === 'string') { + options = { encoding: options } + } else if (!options) { + options = {} + } try { filename = fs.realpathSync(filename) } catch (ex) { diff --git a/node_modules/write-file-atomic/package.json b/node_modules/write-file-atomic/package.json index 98a29a053453a..031eccdba8707 100644 --- a/node_modules/write-file-atomic/package.json +++ b/node_modules/write-file-atomic/package.json @@ -1,16 +1,18 @@ { "name": "write-file-atomic", - "version": "3.0.3", + "version": "4.0.0", "description": "Write files in an atomic fashion w/configurable ownership", - "main": "index.js", + "main": "./lib/index.js", "scripts": { "test": "tap", "posttest": "npm run lint", - "lint": "standard", - "postlint": "rimraf chowncopy good nochmod nochown nofsync nofsyncopt noopen norename \"norename nounlink\" nowrite", + "lint": "eslint '**/*.js'", + "postlint": "npm-template-check", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "lintfix": "npm run lint -- --fix", + "snap": "tap" }, "repository": { "type": "git", @@ -20,7 +22,7 @@ "writeFile", "atomic" ], - "author": "Rebecca Turner (http://re-becca.org)", + "author": "GitHub Inc.", "license": "ISC", "bugs": { "url": "https://github.com/npm/write-file-atomic/issues" @@ -30,19 +32,23 @@ "imurmurhash": "^0.1.4", "is-typedarray": "^1.0.0", "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" + "typedarray-to-buffer": "^4.0.0" }, "devDependencies": { - "mkdirp": "^0.5.1", - "require-inject": "^1.4.4", - "rimraf": "^2.6.3", - "standard": "^14.3.1", - "tap": "^14.10.6" + "@npmcli/template-oss": "^2.5.1", + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2", + "tap": "^15.1.6" }, "files": [ - "index.js" + "bin", + "lib" ], - "tap": { - "100": true + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16" + }, + "templateOSS": { + "windowsCI": false, + "version": "2.5.1" } } diff --git a/package-lock.json b/package-lock.json index 5498b54d795d3..8c7a5c3474ab3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -156,7 +156,7 @@ "treeverse": "^1.0.4", "validate-npm-package-name": "~3.0.0", "which": "^2.0.2", - "write-file-atomic": "^3.0.3" + "write-file-atomic": "^4.0.0" }, "bin": { "npm": "bin/npm-cli.js", @@ -1435,19 +1435,19 @@ } }, "node_modules/bin-links": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-2.3.0.tgz", - "integrity": "sha512-JzrOLHLwX2zMqKdyYZjkDgQGT+kHDkIhv2/IK2lJ00qLxV4TmFoHi8drDBb6H5Zrz1YfgHkai4e2MGPqnoUhqA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-3.0.0.tgz", + "integrity": "sha512-fC7kPWcEkAWBgCKxmAMqZldlIeHsXwQy9JXzrppAVQiukGiDKxmYesJcBKWu6UMwx/5GOfo10wtK/4zy+Xt/mg==", "dependencies": { "cmd-shim": "^4.0.1", "mkdirp-infer-owner": "^2.0.0", "npm-normalize-package-bin": "^1.0.0", "read-cmd-shim": "^2.0.0", "rimraf": "^3.0.0", - "write-file-atomic": "^3.0.3" + "write-file-atomic": "^4.0.0" }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16" } }, "node_modules/binary-extensions": { @@ -1595,6 +1595,27 @@ "node": ">=8" } }, + "node_modules/caching-transform/node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/caching-transform/node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -9597,13 +9618,24 @@ } }, "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "inBundle": true, - "dependencies": { - "is-typedarray": "^1.0.0" - } + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-4.0.0.tgz", + "integrity": "sha512-6dOYeZfS3O9RtRD1caom0sMxgK59b27+IwoNy8RDPsmslSGOyU+mpTamlaIW7aNKi90ZQZ9DFaZL3YRoiSCULQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "inBundle": true }, "node_modules/typescript": { "version": "3.9.10", @@ -10145,15 +10177,18 @@ "inBundle": true }, "node_modules/write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.0.tgz", + "integrity": "sha512-JhcWoKffJNF7ivO9yflBhc7tn3wKnokMUfWpBriM9yCXj4ePQnRPcWglBkkg1AHC8nsW/EfxwwhqsLtOy59djA==", "inBundle": true, "dependencies": { "imurmurhash": "^0.1.4", "is-typedarray": "^1.0.0", "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" + "typedarray-to-buffer": "^4.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16" } }, "node_modules/ws": { @@ -10459,7 +10494,7 @@ "@npmcli/node-gyp": "^1.0.3", "@npmcli/package-json": "^1.0.1", "@npmcli/run-script": "^2.0.0", - "bin-links": "^2.3.0", + "bin-links": "^3.0.0", "cacache": "^15.0.3", "common-ancestor-path": "^1.0.1", "json-parse-even-better-errors": "^2.3.1", @@ -10572,7 +10607,7 @@ }, "devDependencies": { "@npmcli/template-oss": "^2.4.2", - "bin-links": "^2.2.1", + "bin-links": "^3.0.0", "tap": "^15.0.6" }, "engines": { @@ -11372,7 +11407,7 @@ "@npmcli/run-script": "^2.0.0", "@npmcli/template-oss": "^2.4.2", "benchmark": "^2.1.4", - "bin-links": "^2.3.0", + "bin-links": "^3.0.0", "cacache": "^15.0.3", "chalk": "^4.1.0", "common-ancestor-path": "^1.0.1", @@ -11890,16 +11925,16 @@ } }, "bin-links": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-2.3.0.tgz", - "integrity": "sha512-JzrOLHLwX2zMqKdyYZjkDgQGT+kHDkIhv2/IK2lJ00qLxV4TmFoHi8drDBb6H5Zrz1YfgHkai4e2MGPqnoUhqA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-3.0.0.tgz", + "integrity": "sha512-fC7kPWcEkAWBgCKxmAMqZldlIeHsXwQy9JXzrppAVQiukGiDKxmYesJcBKWu6UMwx/5GOfo10wtK/4zy+Xt/mg==", "requires": { "cmd-shim": "^4.0.1", "mkdirp-infer-owner": "^2.0.0", "npm-normalize-package-bin": "^1.0.0", "read-cmd-shim": "^2.0.0", "rimraf": "^3.0.0", - "write-file-atomic": "^3.0.3" + "write-file-atomic": "^4.0.0" } }, "binary-extensions": { @@ -12013,6 +12048,29 @@ "make-dir": "^3.0.0", "package-hash": "^4.0.0", "write-file-atomic": "^3.0.0" + }, + "dependencies": { + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + } } }, "call-bind": { @@ -14384,7 +14442,7 @@ "@npmcli/ci-detect": "^1.3.0", "@npmcli/run-script": "^2.0.0", "@npmcli/template-oss": "^2.4.2", - "bin-links": "^2.2.1", + "bin-links": "^3.0.0", "chalk": "^4.1.0", "mkdirp-infer-owner": "^2.0.0", "npm-package-arg": "^8.1.2", @@ -18000,12 +18058,9 @@ "dev": true }, "typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "requires": { - "is-typedarray": "^1.0.0" - } + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-4.0.0.tgz", + "integrity": "sha512-6dOYeZfS3O9RtRD1caom0sMxgK59b27+IwoNy8RDPsmslSGOyU+mpTamlaIW7aNKi90ZQZ9DFaZL3YRoiSCULQ==" }, "typescript": { "version": "3.9.10", @@ -18414,14 +18469,14 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.0.tgz", + "integrity": "sha512-JhcWoKffJNF7ivO9yflBhc7tn3wKnokMUfWpBriM9yCXj4ePQnRPcWglBkkg1AHC8nsW/EfxwwhqsLtOy59djA==", "requires": { "imurmurhash": "^0.1.4", "is-typedarray": "^1.0.0", "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" + "typedarray-to-buffer": "^4.0.0" } }, "ws": { diff --git a/package.json b/package.json index a4a5fcc6e8d4d..b6288748daa95 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "treeverse": "^1.0.4", "validate-npm-package-name": "~3.0.0", "which": "^2.0.2", - "write-file-atomic": "^3.0.3" + "write-file-atomic": "^4.0.0" }, "bundleDependencies": [ "@isaacs/string-locale-compare", diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index ac2922bc9655d..ed5c8faee9766 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -12,7 +12,7 @@ "@npmcli/node-gyp": "^1.0.3", "@npmcli/package-json": "^1.0.1", "@npmcli/run-script": "^2.0.0", - "bin-links": "^2.3.0", + "bin-links": "^3.0.0", "cacache": "^15.0.3", "common-ancestor-path": "^1.0.1", "json-parse-even-better-errors": "^2.3.1", diff --git a/workspaces/libnpmexec/package.json b/workspaces/libnpmexec/package.json index 8c8812a651a05..ff728b5473bc9 100644 --- a/workspaces/libnpmexec/package.json +++ b/workspaces/libnpmexec/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@npmcli/template-oss": "^2.4.2", - "bin-links": "^2.2.1", + "bin-links": "^3.0.0", "tap": "^15.0.6" }, "dependencies": {