Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gar/deps updates #5156

Merged
merged 8 commits into from Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion node_modules/.gitignore
Expand Up @@ -267,7 +267,6 @@ __pycache__
/lodash.clonedeep
/lodash.flattendeep
/lodash.merge
/lodash.set
/lodash.uniq
/log-driver
/make-dir
Expand Down
2 changes: 1 addition & 1 deletion node_modules/@npmcli/run-script/lib/escape.js
Expand Up @@ -68,7 +68,7 @@ const sh = (input) => {
// disabling the no-control-regex rule for this line as we very specifically _do_ want to
// replace those characters if they somehow exist at this point, which is highly unlikely
// eslint-disable-next-line no-control-regex
const filename = (input) => input.replace(/[<>:"/\\|?*\x00-\x31]/g, '')
const filename = (input) => input.replace(/[<>:"/\\|?*\x00-\x1F]/g, '')

module.exports = {
cmd,
Expand Down
24 changes: 12 additions & 12 deletions node_modules/@npmcli/run-script/lib/make-spawn-args.js
@@ -1,12 +1,19 @@
/* eslint camelcase: "off" */
const isWindows = require('./is-windows.js')
const setPATH = require('./set-path.js')
const { chmodSync: chmod, unlinkSync: unlink, writeFileSync: writeFile } = require('fs')
const { unlinkSync: unlink, writeFileSync: writeFile } = require('fs')
const { tmpdir } = require('os')
const { isAbsolute, resolve } = require('path')
const { resolve } = require('path')
const which = require('which')
const npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js')
const escape = require('./escape.js')
const { randomBytes } = require('crypto')

const translateWinPathToPosix = (path) => {
return path
.replace(/^([A-z]):/, '/$1')
.replace(/\\/g, '/')
}

const makeSpawnArgs = options => {
const {
Expand All @@ -30,7 +37,7 @@ const makeSpawnArgs = options => {
npm_config_node_gyp,
})

const fileName = escape.filename(`${event}-${Date.now()}`)
const fileName = escape.filename(`${event}-${randomBytes(4).toString('hex')}`)
let scriptFile
let script = ''

Expand Down Expand Up @@ -69,24 +76,17 @@ const makeSpawnArgs = options => {
script += ` ${args.map((arg) => escape.cmd(arg, doubleEscape)).join(' ')}`
}
} else {
const shebang = isAbsolute(scriptShell)
? `#!${scriptShell}`
: `#!/usr/bin/env ${scriptShell}`
scriptFile = resolve(tmpdir(), `${fileName}.sh`)
script += `${shebang}\n`
script += cmd
script = cmd
if (args.length) {
script += ` ${args.map((arg) => escape.sh(arg)).join(' ')}`
}
}

writeFile(scriptFile, script)
if (!isCmd) {
chmod(scriptFile, '0775')
}
const spawnArgs = isCmd
? ['/d', '/s', '/c', escape.cmd(scriptFile)]
: ['-c', escape.sh(scriptFile)]
: [isWindows ? translateWinPathToPosix(scriptFile) : scriptFile]

const spawnOpts = {
env: spawnEnv,
Expand Down
2 changes: 1 addition & 1 deletion node_modules/@npmcli/run-script/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/run-script",
"version": "4.1.5",
"version": "4.1.7",
"description": "Run a lifecycle script for a package (descendant of npm-lifecycle)",
"author": "GitHub Inc.",
"license": "ISC",
Expand Down
2 changes: 1 addition & 1 deletion node_modules/just-diff-apply/index.d.ts
@@ -1,6 +1,6 @@
// Definitions by: Eddie Atkinson <https://github.com/eddie-atkinson>

type Operation = "add" | "replace" | "remove";
type Operation = "add" | "replace" | "remove" | "move";

type DiffOps = Array<{
op: Operation;
Expand Down
69 changes: 58 additions & 11 deletions node_modules/just-diff-apply/index.mjs
Expand Up @@ -42,6 +42,7 @@
var REMOVE = 'remove';
var REPLACE = 'replace';
var ADD = 'add';
var MOVE = 'move';

function diffApply(obj, diff, pathConverter) {
if (!obj || typeof obj != 'object') {
Expand All @@ -57,23 +58,40 @@ function diffApply(obj, diff, pathConverter) {
var thisDiff = diff[i];
var subObject = obj;
var thisOp = thisDiff.op;
var thisPath = thisDiff.path;
if (pathConverter) {
thisPath = pathConverter(thisPath);
if (!Array.isArray(thisPath)) {
throw new Error('pathConverter must return an array');

var thisPath = transformPath(pathConverter, thisDiff.path);
var thisFromPath = thisDiff.from && transformPath(pathConverter, thisDiff.from);
var toPath, toPathCopy, lastToProp, subToObject, valueToMove;

if (thisFromPath) {
// MOVE only, "fromPath" is effectively path and "path" is toPath
toPath = thisPath;
thisPath = thisFromPath;

toPathCopy = toPath.slice();
lastToProp = toPathCopy.pop();
prototypeCheck(lastToProp);
if (lastToProp == null) {
return false;
}
} else {
if (!Array.isArray(thisPath)) {
throw new Error('diff path must be an array, consider supplying a path converter');

var thisToProp;
while (((thisToProp = toPathCopy.shift())) != null) {
prototypeCheck(thisToProp);
if (!(thisToProp in subToObject)) {
subToObject[thisToProp] = {};
}
subToObject = subToObject[thisToProp];
}
}

var pathCopy = thisPath.slice();
var lastProp = pathCopy.pop();
prototypeCheck(lastProp);
if (lastProp == null) {
return false;
}

var thisProp;
while (((thisProp = pathCopy.shift())) != null) {
prototypeCheck(thisProp);
Expand All @@ -82,21 +100,50 @@ function diffApply(obj, diff, pathConverter) {
}
subObject = subObject[thisProp];
}
if (thisOp === REMOVE || thisOp === REPLACE) {
if (thisOp === REMOVE || thisOp === REPLACE || thisOp === MOVE) {
var path = thisOp === MOVE ? thisDiff.from : thisDiff.path;
if (!subObject.hasOwnProperty(lastProp)) {
throw new Error(['expected to find property', thisDiff.path, 'in object', obj].join(' '));
throw new Error(['expected to find property', path, 'in object', obj].join(' '));
}
}
if (thisOp === REMOVE) {
if (thisOp === REMOVE || thisOp === MOVE) {
if (thisOp === MOVE) {
valueToMove = subObject[lastProp];
}
Array.isArray(subObject) ? subObject.splice(lastProp, 1) : delete subObject[lastProp];
}
if (thisOp === REPLACE || thisOp === ADD) {
subObject[lastProp] = thisDiff.value;
}

if (thisOp === MOVE) {
subObject[lastToProp] = valueToMove;
}
}
return subObject;
}

function transformPath(pathConverter, thisPath) {
if(pathConverter) {
thisPath = pathConverter(thisPath);
if(!Array.isArray(thisPath)) {
throw new Error([
'pathConverter must return an array, returned:',
thisPath,
].join(' '));
}
} else {
if(!Array.isArray(thisPath)) {
throw new Error([
'diff path',
thisPath,
'must be an array, consider supplying a path converter']
.join(' '));
}
}
return thisPath;
}

function jsonPatchPathConverter(stringPath) {
return stringPath.split('/').slice(1);
}
Expand Down
2 changes: 1 addition & 1 deletion node_modules/just-diff-apply/package.json
@@ -1,6 +1,6 @@
{
"name": "just-diff-apply",
"version": "5.2.0",
"version": "5.3.1",
"description": "Apply a diff to an object. Optionally supports jsonPatch protocol",
"main": "index.js",
"module": "index.mjs",
Expand Down
8 changes: 6 additions & 2 deletions node_modules/just-diff/index.mjs
Expand Up @@ -124,9 +124,13 @@ function diff(obj1, obj2, pathConverter) {
}
}

return diffs.remove.reverse().concat(diffs.replace).concat(diffs.add);
return diffs;
}
return getDiff(obj1, obj2, [], {remove: [], replace: [], add: []});
const finalDiffs = getDiff(obj1, obj2, [], {remove: [], replace: [], add: []});
return finalDiffs.remove
.reverse()
.concat(finalDiffs.replace)
.concat(finalDiffs.add);
}

function pushReplace(path, basePath, key, diffs, pathConverter, obj2) {
Expand Down
2 changes: 1 addition & 1 deletion node_modules/just-diff/package.json
@@ -1,6 +1,6 @@
{
"name": "just-diff",
"version": "5.0.2",
"version": "5.0.3",
"description": "Return an object representing the diffs between two objects. Supports jsonPatch protocol",
"main": "index.js",
"module": "index.mjs",
Expand Down