Bump the npm group with 3 updates (#2303)

* ---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2024-05-20 12:17:29 -07:00 committed by GitHub
parent ebd27c09f6
commit b1bd8da5e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
212 changed files with 11182 additions and 16383 deletions

176
node_modules/.package-lock.json generated vendored
View file

@ -814,9 +814,9 @@
"integrity": "sha512-D3LxMCnkgsb4LO5sDKf6E+yahM2SqpEHmkqMPDSJis5Cy/j2MgWo/g/iq0lECK0mrPWfx3hqKm2ZJlqxwbRJQA=="
},
"node_modules/@sinonjs/commons": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz",
"integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz",
"integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==",
"dev": true,
"dependencies": {
"type-detect": "4.0.8"
@ -954,16 +954,16 @@
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.9.0.tgz",
"integrity": "sha512-6e+X0X3sFe/G/54aC3jt0txuMTURqLyekmEHViqyA2VnxhLMpvA6nqmcjIy+Cr9tLDHPssA74BP5Mx9HQIxBEA==",
"version": "7.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.10.0.tgz",
"integrity": "sha512-PzCr+a/KAef5ZawX7nbyNwBDtM1HdLIT53aSA2DDlxmxMngZ43O8SIePOeX8H5S+FHXeI6t97mTt/dDdzY4Fyw==",
"dev": true,
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "7.9.0",
"@typescript-eslint/type-utils": "7.9.0",
"@typescript-eslint/utils": "7.9.0",
"@typescript-eslint/visitor-keys": "7.9.0",
"@typescript-eslint/scope-manager": "7.10.0",
"@typescript-eslint/type-utils": "7.10.0",
"@typescript-eslint/utils": "7.10.0",
"@typescript-eslint/visitor-keys": "7.10.0",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"natural-compare": "^1.4.0",
@ -987,15 +987,15 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.9.0.tgz",
"integrity": "sha512-qHMJfkL5qvgQB2aLvhUSXxbK7OLnDkwPzFalg458pxQgfxKDfT1ZDbHQM/I6mDIf/svlMkj21kzKuQ2ixJlatQ==",
"version": "7.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.10.0.tgz",
"integrity": "sha512-2EjZMA0LUW5V5tGQiaa2Gys+nKdfrn2xiTIBLR4fxmPmVSvgPcKNW+AE/ln9k0A4zDUti0J/GZXMDupQoI+e1w==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "7.9.0",
"@typescript-eslint/types": "7.9.0",
"@typescript-eslint/typescript-estree": "7.9.0",
"@typescript-eslint/visitor-keys": "7.9.0",
"@typescript-eslint/scope-manager": "7.10.0",
"@typescript-eslint/types": "7.10.0",
"@typescript-eslint/typescript-estree": "7.10.0",
"@typescript-eslint/visitor-keys": "7.10.0",
"debug": "^4.3.4"
},
"engines": {
@ -1015,13 +1015,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.9.0.tgz",
"integrity": "sha512-ZwPK4DeCDxr3GJltRz5iZejPFAAr4Wk3+2WIBaj1L5PYK5RgxExu/Y68FFVclN0y6GGwH8q+KgKRCvaTmFBbgQ==",
"version": "7.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.10.0.tgz",
"integrity": "sha512-7L01/K8W/VGl7noe2mgH0K7BE29Sq6KAbVmxurj8GGaPDZXPr8EEQ2seOeAS+mEV9DnzxBQB6ax6qQQ5C6P4xg==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "7.9.0",
"@typescript-eslint/visitor-keys": "7.9.0"
"@typescript-eslint/types": "7.10.0",
"@typescript-eslint/visitor-keys": "7.10.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
@ -1032,13 +1032,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.9.0.tgz",
"integrity": "sha512-6Qy8dfut0PFrFRAZsGzuLoM4hre4gjzWJB6sUvdunCYZsYemTkzZNwF1rnGea326PHPT3zn5Lmg32M/xfJfByA==",
"version": "7.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.10.0.tgz",
"integrity": "sha512-D7tS4WDkJWrVkuzgm90qYw9RdgBcrWmbbRkrLA4d7Pg3w0ttVGDsvYGV19SH8gPR5L7OtcN5J1hTtyenO9xE9g==",
"dev": true,
"dependencies": {
"@typescript-eslint/typescript-estree": "7.9.0",
"@typescript-eslint/utils": "7.9.0",
"@typescript-eslint/typescript-estree": "7.10.0",
"@typescript-eslint/utils": "7.10.0",
"debug": "^4.3.4",
"ts-api-utils": "^1.3.0"
},
@ -1059,9 +1059,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.9.0.tgz",
"integrity": "sha512-oZQD9HEWQanl9UfsbGVcZ2cGaR0YT5476xfWE0oE5kQa2sNK2frxOlkeacLOTh9po4AlUT5rtkGyYM5kew0z5w==",
"version": "7.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.10.0.tgz",
"integrity": "sha512-7fNj+Ya35aNyhuqrA1E/VayQX9Elwr8NKZ4WueClR3KwJ7Xx9jcCdOrLW04h51de/+gNbyFMs+IDxh5xIwfbNg==",
"dev": true,
"engines": {
"node": "^18.18.0 || >=20.0.0"
@ -1072,13 +1072,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.9.0.tgz",
"integrity": "sha512-zBCMCkrb2YjpKV3LA0ZJubtKCDxLttxfdGmwZvTqqWevUPN0FZvSI26FalGFFUZU/9YQK/A4xcQF9o/VVaCKAg==",
"version": "7.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.10.0.tgz",
"integrity": "sha512-LXFnQJjL9XIcxeVfqmNj60YhatpRLt6UhdlFwAkjNc6jSUlK8zQOl1oktAP8PlWFzPQC1jny/8Bai3/HPuvN5g==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "7.9.0",
"@typescript-eslint/visitor-keys": "7.9.0",
"@typescript-eslint/types": "7.10.0",
"@typescript-eslint/visitor-keys": "7.10.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@ -1124,15 +1124,15 @@
}
},
"node_modules/@typescript-eslint/utils": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.9.0.tgz",
"integrity": "sha512-5KVRQCzZajmT4Ep+NEgjXCvjuypVvYHUW7RHlXzNPuak2oWpVoD1jf5xCP0dPAuNIchjC7uQyvbdaSTFaLqSdA==",
"version": "7.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.10.0.tgz",
"integrity": "sha512-olzif1Fuo8R8m/qKkzJqT7qwy16CzPRWBvERS0uvyc+DHd8AKbO4Jb7kpAvVzMmZm8TrHnI7hvjN4I05zow+tg==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "7.9.0",
"@typescript-eslint/types": "7.9.0",
"@typescript-eslint/typescript-estree": "7.9.0"
"@typescript-eslint/scope-manager": "7.10.0",
"@typescript-eslint/types": "7.10.0",
"@typescript-eslint/typescript-estree": "7.10.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
@ -1146,12 +1146,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.9.0.tgz",
"integrity": "sha512-iESPx2TNLDNGQLyjKhUvIKprlP49XNEK+MvIf9nIO7ZZaZdbnfWKHnXAgufpxqfA0YryH8XToi4+CjBgVnFTSQ==",
"version": "7.10.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.10.0.tgz",
"integrity": "sha512-9ntIVgsi6gg6FIq9xjEO4VQJvwOqA3jaBFQJ/6TK5AvEup2+cECI6Fh7QiBxmfMHXU0V0J4RyPeOU1VDNzl9cg==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "7.9.0",
"@typescript-eslint/types": "7.10.0",
"eslint-visitor-keys": "^3.4.3"
},
"engines": {
@ -2301,9 +2301,9 @@
}
},
"node_modules/diff": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz",
"integrity": "sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==",
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz",
"integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==",
"dev": true,
"engines": {
"node": ">=0.3.1"
@ -4165,12 +4165,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==",
"dev": true
},
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@ -4247,9 +4241,9 @@
}
},
"node_modules/just-extend": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz",
"integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==",
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz",
"integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==",
"dev": true
},
"node_modules/language-subtag-registry": {
@ -4502,43 +4496,16 @@
"dev": true
},
"node_modules/nise": {
"version": "5.1.5",
"resolved": "https://registry.npmjs.org/nise/-/nise-5.1.5.tgz",
"integrity": "sha512-VJuPIfUFaXNRzETTQEEItTOP8Y171ijr+JLq42wHes3DiryR8vT+1TXQW/Rx8JNUhyYYWyIvjXTU6dOhJcs9Nw==",
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/nise/-/nise-6.0.0.tgz",
"integrity": "sha512-K8ePqo9BFvN31HXwEtTNGzgrPpmvgciDsFz8aztFjt4LqKO/JeFD8tBOeuDiCMXrIl/m1YvfH8auSpxfaD09wg==",
"dev": true,
"dependencies": {
"@sinonjs/commons": "^2.0.0",
"@sinonjs/fake-timers": "^10.0.2",
"@sinonjs/text-encoding": "^0.7.1",
"just-extend": "^4.0.2",
"path-to-regexp": "^1.7.0"
}
},
"node_modules/nise/node_modules/@sinonjs/commons": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz",
"integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==",
"dev": true,
"dependencies": {
"type-detect": "4.0.8"
}
},
"node_modules/nise/node_modules/@sinonjs/fake-timers": {
"version": "10.3.0",
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz",
"integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==",
"dev": true,
"dependencies": {
"@sinonjs/commons": "^3.0.0"
}
},
"node_modules/nise/node_modules/@sinonjs/fake-timers/node_modules/@sinonjs/commons": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz",
"integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==",
"dev": true,
"dependencies": {
"type-detect": "4.0.8"
"@sinonjs/commons": "^3.0.0",
"@sinonjs/fake-timers": "^11.2.2",
"@sinonjs/text-encoding": "^0.7.2",
"just-extend": "^6.2.0",
"path-to-regexp": "^6.2.1"
}
},
"node_modules/nock": {
@ -4939,13 +4906,10 @@
"dev": true
},
"node_modules/path-to-regexp": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
"integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
"dev": true,
"dependencies": {
"isarray": "0.0.1"
}
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz",
"integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==",
"dev": true
},
"node_modules/path-type": {
"version": "4.0.0",
@ -5496,17 +5460,17 @@
"dev": true
},
"node_modules/sinon": {
"version": "17.0.1",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-17.0.1.tgz",
"integrity": "sha512-wmwE19Lie0MLT+ZYNpDymasPHUKTaZHUH/pKEubRXIzySv9Atnlw+BUMGCzWgV7b7wO+Hw6f1TEOr0IUnmU8/g==",
"version": "18.0.0",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-18.0.0.tgz",
"integrity": "sha512-+dXDXzD1sBO6HlmZDd7mXZCR/y5ECiEiGCBSGuFD/kZ0bDTofPYc6JaeGmPSF+1j1MejGUWkORbYOLDyvqCWpA==",
"dev": true,
"dependencies": {
"@sinonjs/commons": "^3.0.0",
"@sinonjs/commons": "^3.0.1",
"@sinonjs/fake-timers": "^11.2.2",
"@sinonjs/samsam": "^8.0.0",
"diff": "^5.1.0",
"nise": "^5.1.5",
"supports-color": "^7.2.0"
"diff": "^5.2.0",
"nise": "^6.0.0",
"supports-color": "^7"
},
"funding": {
"type": "opencollective",

View file

@ -33,7 +33,6 @@ function checkAdjacentCalls(callMap, spy, index, spies) {
/**
* A Sinon proxy object (fake, spy, stub)
*
* @typedef {object} SinonProxy
* @property {Function} calledBefore - A method that determines if this proxy was called before another one
* @property {string} id - Some id
@ -42,7 +41,6 @@ function checkAdjacentCalls(callMap, spy, index, spies) {
/**
* Returns true when the spies have been called in the order they were supplied in
*
* @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments
* @returns {boolean} true when spies are called in order, false otherwise
*/

View file

@ -1,27 +1,13 @@
"use strict";
var functionName = require("./function-name");
/**
* Returns a display name for a value from a constructor
*
* @param {object} value A value to examine
* @returns {(string|null)} A string or null
*/
function className(value) {
return (
(value.constructor && value.constructor.name) ||
// The next branch is for IE11 support only:
// Because the name property is not set on the prototype
// of the Function object, we finally try to grab the
// name from its definition. This will never be reached
// in node, so we are not able to test this properly.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
(typeof value.constructor === "function" &&
/* istanbul ignore next */
functionName(value.constructor)) ||
null
);
const name = value.constructor && value.constructor.name;
return name || null;
}
module.exports = className;

View file

@ -4,7 +4,6 @@
/**
* Returns a function that will invoke the supplied function and print a
* deprecation warning to the console each time it is called.
*
* @param {Function} func
* @param {string} msg
* @returns {Function}
@ -23,7 +22,6 @@ exports.wrap = function (func, msg) {
/**
* Returns a string which can be supplied to `wrap()` to notify the user that a
* particular part of the sinon API has been deprecated.
*
* @param {string} packageName
* @param {string} funcName
* @returns {string}
@ -34,7 +32,6 @@ exports.defaultMsg = function (packageName, funcName) {
/**
* Prints a warning on the console, when it exists
*
* @param {string} msg
* @returns {undefined}
*/

View file

@ -3,7 +3,6 @@
/**
* Returns true when fn returns true for all members of obj.
* This is an every implementation that works for all iterables
*
* @param {object} obj
* @param {Function} fn
* @returns {boolean}

View file

@ -2,7 +2,6 @@
/**
* Returns a display name for a function
*
* @param {Function} func
* @returns {string}
*/

View file

@ -2,7 +2,6 @@
/**
* A reference to the global object
*
* @type {object} globalObject
*/
var globalObject;

View file

@ -18,14 +18,12 @@ function comparator(a, b) {
/**
* A Sinon proxy object (fake, spy, stub)
*
* @typedef {object} SinonProxy
* @property {Function} getCall - A method that can return the first call
*/
/**
* Sorts an array of SinonProxy instances (fake, spy, stub) by their first call
*
* @param {SinonProxy[] | SinonProxy} spies
* @returns {SinonProxy[]}
*/

View file

@ -3,11 +3,9 @@
/**
* Is true when the environment causes an error to be thrown for accessing the
* __proto__ property.
*
* This is necessary in order to support `node --disable-proto=throw`.
*
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto
*
* @type {boolean}
*/
let throwsOnProto;

View file

@ -4,7 +4,6 @@ var type = require("type-detect");
/**
* Returns the lower-case result of running type from type-detect on the value
*
* @param {*} value
* @returns {string}
*/

View file

@ -2,7 +2,6 @@
/**
* Returns a string representation of the value
*
* @param {*} value
* @returns {string}
*/

View file

@ -1,6 +1,6 @@
{
"name": "@sinonjs/commons",
"version": "3.0.0",
"version": "3.0.1",
"description": "Simple functions shared among the sinon end user libraries",
"main": "lib/index.js",
"types": "./types/index.d.ts",

View file

@ -1,7 +1,6 @@
export = calledInOrder;
/**
* A Sinon proxy object (fake, spy, stub)
*
* @typedef {object} SinonProxy
* @property {Function} calledBefore - A method that determines if this proxy was called before another one
* @property {string} id - Some id
@ -9,7 +8,6 @@ export = calledInOrder;
*/
/**
* Returns true when the spies have been called in the order they were supplied in
*
* @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments
* @returns {boolean} true when spies are called in order, false otherwise
*/

View file

@ -1,7 +1,6 @@
export = className;
/**
* Returns a display name for a value from a constructor
*
* @param {object} value A value to examine
* @returns {(string|null)} A string or null
*/

View file

@ -1,7 +1,6 @@
export = globalObject;
/**
* A reference to the global object
*
* @type {object} globalObject
*/
declare var globalObject: object;

View file

@ -1,13 +1,11 @@
export = orderByFirstCall;
/**
* A Sinon proxy object (fake, spy, stub)
*
* @typedef {object} SinonProxy
* @property {Function} getCall - A method that can return the first call
*/
/**
* Sorts an array of SinonProxy instances (fake, spy, stub) by their first call
*
* @param {SinonProxy[] | SinonProxy} spies
* @returns {SinonProxy[]}
*/

View file

@ -2,11 +2,9 @@ export = throwsOnProto;
/**
* Is true when the environment causes an error to be thrown for accessing the
* __proto__ property.
*
* This is necessary in order to support `node --disable-proto=throw`.
*
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto
*
* @type {boolean}
*/
declare let throwsOnProto: boolean;

View file

@ -1,7 +1,6 @@
export = valueToString;
/**
* Returns a string representation of the value
*
* @param {*} value
* @returns {string}
*/

View file

@ -78,15 +78,22 @@ exports.default = (0, util_1.createRule)({
}
return result;
}
function isLikelyToContainGlobalFlag(node) {
if (node.type === utils_1.AST_NODE_TYPES.CallExpression ||
node.type === utils_1.AST_NODE_TYPES.NewExpression) {
/**
* Returns true if and only if we have syntactic proof that the /g flag is
* absent. Returns false in all other cases (i.e. it still might or might
* not contain the global flag).
*/
function definitelyDoesNotContainGlobalFlag(node) {
if ((node.type === utils_1.AST_NODE_TYPES.CallExpression ||
node.type === utils_1.AST_NODE_TYPES.NewExpression) &&
node.callee.type === utils_1.AST_NODE_TYPES.Identifier &&
node.callee.name === 'RegExp') {
const flags = node.arguments.at(1);
return !!(flags?.type === utils_1.AST_NODE_TYPES.Literal &&
return !(flags?.type === utils_1.AST_NODE_TYPES.Literal &&
typeof flags.value === 'string' &&
flags.value.includes('g'));
}
return node.type === utils_1.AST_NODE_TYPES.Identifier;
return false;
}
return {
"CallExpression[arguments.length=1] > MemberExpression.callee[property.name='match'][computed=false]"(memberNode) {
@ -98,7 +105,8 @@ exports.default = (0, util_1.createRule)({
return;
}
// Don't report regular expressions with global flag.
if ((!argumentValue && isLikelyToContainGlobalFlag(argumentNode)) ||
if ((!argumentValue &&
!definitelyDoesNotContainGlobalFlag(argumentNode)) ||
(argumentValue &&
argumentValue.value instanceof RegExp &&
argumentValue.value.flags.includes('g'))) {

View file

@ -1 +1 @@
{"version":3,"file":"prefer-regexp-exec.js","sourceRoot":"","sources":["../../src/rules/prefer-regexp-exec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,oDAA0D;AAC1D,sDAAwC;AAGxC,kCAMiB;AAEjB,IAAK,YAKJ;AALD,WAAK,YAAY;IACf,iDAAS,CAAA;IACT,mDAAe,CAAA;IACf,mDAAe,CAAA;IACf,+CAAsB,CAAA;AACxB,CAAC,EALI,YAAY,KAAZ,YAAY,QAKhB;AAED,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,oBAAoB;IAC1B,cAAc,EAAE,EAAE;IAElB,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,MAAM;QACf,IAAI,EAAE;YACJ,WAAW,EACT,yEAAyE;YAC3E,oBAAoB,EAAE,IAAI;SAC3B;QACD,QAAQ,EAAE;YACR,yBAAyB,EAAE,yCAAyC;SACrE;QACD,MAAM,EAAE,EAAE;KACX;IAED,MAAM,CAAC,OAAO;QACZ,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAElD;;;WAGG;QACH,SAAS,YAAY,CAAC,IAAa;YACjC,OAAO,IAAA,kBAAW,EAAC,OAAO,EAAE,IAAI,CAAC,KAAK,QAAQ,CAAC;QACjD,CAAC;QAED;;;WAGG;QACH,SAAS,YAAY,CAAC,IAAa;YACjC,OAAO,IAAA,kBAAW,EAAC,OAAO,EAAE,IAAI,CAAC,KAAK,QAAQ,CAAC;QACjD,CAAC;QAED,SAAS,oBAAoB,CAAC,KAAgB;YAC5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B;4BACtC,GAAG,EAAE,IAAA,uBAAgB,EAAC;gCACpB,UAAU,EAAE,OAAO,CAAC,UAAU;gCAC9B,IAAI,EAAE,QAAQ;gCACd,SAAS,EAAE,CAAC,UAAU,EAAE,YAAY,CAAC;gCACrC,IAAI,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,EAAE,CACjC,UAAU,YAAY,UAAU,UAAU,GAAG;6BAChD,CAAC;yBACH,CAAC,CAAC;gBACP,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}

View file

@ -81,6 +81,15 @@ function getGroup(node) {
throw new Error(`Unexpected Type ${node.type}`);
}
}
function caseSensitiveSort(a, b) {
if (a < b) {
return -1;
}
else if (a > b) {
return 1;
}
return 0;
}
exports.default = (0, util_1.createRule)({
name: 'sort-type-constituents',
meta: {
@ -108,6 +117,10 @@ exports.default = (0, util_1.createRule)({
description: 'Whether to check union types.',
type: 'boolean',
},
caseSensitive: {
description: 'Whether to sort using case sensitive sorting.',
type: 'boolean',
},
groupOrder: {
description: 'Ordering of the groups.',
type: 'array',
@ -124,6 +137,7 @@ exports.default = (0, util_1.createRule)({
{
checkIntersections: true,
checkUnions: true,
caseSensitive: false,
groupOrder: [
Group.named,
Group.keyword,
@ -140,7 +154,7 @@ exports.default = (0, util_1.createRule)({
],
},
],
create(context, [{ checkIntersections, checkUnions, groupOrder }]) {
create(context, [{ checkIntersections, checkUnions, caseSensitive, groupOrder }]) {
const collator = new Intl.Collator('en', {
sensitivity: 'base',
numeric: true,
@ -158,6 +172,9 @@ exports.default = (0, util_1.createRule)({
if (a.group !== b.group) {
return a.group - b.group;
}
if (caseSensitive) {
return caseSensitiveSort(a.text, b.text);
}
return (collator.compare(a.text, b.text) ||
(a.text < b.text ? -1 : a.text > b.text ? 1 : 0));
});

File diff suppressed because one or more lines are too long

View file

@ -100,7 +100,7 @@ With this option set to `true`, and if you are using `no-void`, you should turn
### `ignoreIIFE`
This allows you to skip checking of async IIFEs (Immediately Invoked function Expressions).
This allows you to skip checking of async IIFEs (Immediately Invoked Function Expressions).
Examples of **correct** code for this rule with `{ ignoreIIFE: true }`:

View file

@ -97,6 +97,29 @@ type T4 =
## Options
### `caseSensitive`
Whether to sort using case sensitive string comparisons.
Examples of code with `{ "caseSensitive": true }`:
<Tabs>
<TabItem value="❌ Incorrect">
```ts option='{ "caseSensitive": true }'
type T = 'DeletedAt' | 'DeleteForever';
```
</TabItem>
<TabItem value="✅ Correct">
```ts option='{ "caseSensitive": true }'
type T = 'DeleteForever' | 'DeletedAt';
```
</TabItem>
</Tabs>
### `checkIntersections`
Whether to check intersection types (`&`).

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin",
"version": "7.9.0",
"version": "7.10.0",
"description": "TypeScript plugin for ESLint",
"files": [
"dist",
@ -62,10 +62,10 @@
},
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "7.9.0",
"@typescript-eslint/type-utils": "7.9.0",
"@typescript-eslint/utils": "7.9.0",
"@typescript-eslint/visitor-keys": "7.9.0",
"@typescript-eslint/scope-manager": "7.10.0",
"@typescript-eslint/type-utils": "7.10.0",
"@typescript-eslint/utils": "7.10.0",
"@typescript-eslint/visitor-keys": "7.10.0",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"natural-compare": "^1.4.0",
@ -76,8 +76,8 @@
"@types/marked": "^5.0.2",
"@types/mdast": "^4.0.3",
"@types/natural-compare": "*",
"@typescript-eslint/rule-schema-to-typescript-types": "7.9.0",
"@typescript-eslint/rule-tester": "7.9.0",
"@typescript-eslint/rule-schema-to-typescript-types": "7.10.0",
"@typescript-eslint/rule-tester": "7.10.0",
"ajv": "^6.12.6",
"cross-env": "^7.0.3",
"cross-fetch": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/parser",
"version": "7.9.0",
"version": "7.10.0",
"description": "An ESLint custom parser which leverages TypeScript ESTree",
"files": [
"dist",
@ -52,10 +52,10 @@
"eslint": "^8.56.0"
},
"dependencies": {
"@typescript-eslint/scope-manager": "7.9.0",
"@typescript-eslint/types": "7.9.0",
"@typescript-eslint/typescript-estree": "7.9.0",
"@typescript-eslint/visitor-keys": "7.9.0",
"@typescript-eslint/scope-manager": "7.10.0",
"@typescript-eslint/types": "7.10.0",
"@typescript-eslint/typescript-estree": "7.10.0",
"@typescript-eslint/visitor-keys": "7.10.0",
"debug": "^4.3.4"
},
"devDependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
"version": "7.9.0",
"version": "7.10.0",
"description": "TypeScript scope analyser for ESLint",
"files": [
"dist",
@ -46,13 +46,13 @@
"typecheck": "npx nx typecheck"
},
"dependencies": {
"@typescript-eslint/types": "7.9.0",
"@typescript-eslint/visitor-keys": "7.9.0"
"@typescript-eslint/types": "7.10.0",
"@typescript-eslint/visitor-keys": "7.10.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@types/glob": "*",
"@typescript-eslint/typescript-estree": "7.9.0",
"@typescript-eslint/typescript-estree": "7.10.0",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/type-utils",
"version": "7.9.0",
"version": "7.10.0",
"description": "Type utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -46,14 +46,14 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/typescript-estree": "7.9.0",
"@typescript-eslint/utils": "7.9.0",
"@typescript-eslint/typescript-estree": "7.10.0",
"@typescript-eslint/utils": "7.10.0",
"debug": "^4.3.4",
"ts-api-utils": "^1.3.0"
},
"devDependencies": {
"@jest/types": "29.6.3",
"@typescript-eslint/parser": "7.9.0",
"@typescript-eslint/parser": "7.10.0",
"ajv": "^6.12.6",
"downlevel-dts": "*",
"jest": "29.7.0",

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
"version": "7.9.0",
"version": "7.10.0",
"description": "Types for the TypeScript-ESTree AST spec",
"files": [
"dist",

View file

@ -1 +1 @@
{"version":3,"file":"useProgramFromProjectService.d.ts","sourceRoot":"","sources":["../src/useProgramFromProjectService.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAM5D,wBAAgB,4BAA4B,CAC1C,EACE,2BAA2B,EAC3B,mCAAmC,EACnC,OAAO,GACR,EAAE,sBAAsB,EACzB,aAAa,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAC7C,sBAAsB,EAAE,OAAO,EAC/B,0BAA0B,EAAE,GAAG,CAAC,MAAM,CAAC,GACtC,qBAAqB,GAAG,SAAS,CAqFnC"}
{"version":3,"file":"useProgramFromProjectService.d.ts","sourceRoot":"","sources":["../src/useProgramFromProjectService.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAM5D,wBAAgB,4BAA4B,CAC1C,EACE,2BAA2B,EAC3B,mCAAmC,EACnC,OAAO,GACR,EAAE,sBAAsB,EACzB,aAAa,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAC7C,sBAAsB,EAAE,OAAO,EAC/B,0BAA0B,EAAE,GAAG,CAAC,MAAM,CAAC,GACtC,qBAAqB,GAAG,SAAS,CAuFnC"}

View file

@ -43,7 +43,9 @@ function useProgramFromProjectService({ allowDefaultProjectForFiles, maximumDefa
log('Could not find project service program for: %s', filePathAbsolute);
return undefined;
}
defaultProjectMatchedFiles.add(filePathAbsolute);
if (!opened.configFileName) {
defaultProjectMatchedFiles.add(filePathAbsolute);
}
if (defaultProjectMatchedFiles.size > maximumDefaultProjectFileMatchCount) {
throw new Error(`Too many files (>${maximumDefaultProjectFileMatchCount}) have matched the default project.${validateDefaultProjectForFilesGlob_1.DEFAULT_PROJECT_FILES_ERROR_EXPLANATION}
Matching files:

View file

@ -1 +1 @@
{"version":3,"file":"useProgramFromProjectService.js","sourceRoot":"","sources":["../src/useProgramFromProjectService.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yCAAsC;AACtC,gDAAwB;AAExB,gFAA6E;AAG7E,4GAA8G;AAG9G,MAAM,GAAG,GAAG,IAAA,eAAK,EACf,kEAAkE,CACnE,CAAC;AAEF,SAAgB,4BAA4B,CAC1C,EACE,2BAA2B,EAC3B,mCAAmC,EACnC,OAAO,GACgB,EACzB,aAA6C,EAC7C,sBAA+B,EAC/B,0BAAuC;IAEvC,iFAAiF;IACjF,yEAAyE;IACzE,MAAM,gBAAgB,GAAG,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC5D,GAAG,CACD,0DAA0D,EAC1D,aAAa,CAAC,QAAQ,EACtB,gBAAgB,CACjB,CAAC;IAEF,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CACnC,gBAAgB,EAChB,aAAa,CAAC,YAAY;IAC1B,gBAAgB,CAAC,SAAS,EAC1B,aAAa,CAAC,eAAe,CAC9B,CAAC;IAEF,GAAG,CAAC,iCAAiC,EAAE,MAAM,CAAC,CAAC;IAE/C,IAAI,sBAAsB,EAAE,CAAC;QAC3B,GAAG,CACD,+EAA+E,EAC/E,2BAA2B,CAC5B,CAAC;QACF,MAAM,2BAA2B,GAAG,iBAAiB,CACnD,aAAa,CAAC,QAAQ,EACtB,2BAA2B,CAC5B,CAAC;QAEF,GAAG,CACD,4DAA4D,EAC5D,2BAA2B,EAC3B,MAAM,CAAC,cAAc,CACtB,CAAC;QAEF,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;YAC1B,IAAI,2BAA2B,EAAE,CAAC;g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;;;CAGZ,CACI,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,uCAAuC,EAAE,gBAAgB,CAAC,CAAC;IAE/D,OAAO,IAAA,2CAAoB,EAAC,aAAa,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEtD,SAAS,UAAU,CAAC,QAAgB;QAClC,OAAO,cAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAC9B,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAhGD,oEAgGC;AAED,SAAS,iBAAiB,CACxB,QAAgB,EAChB,2BAAiD;IAEjD,OAAO,CAAC,CAAC,2BAA2B,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CACnD,IAAA,qBAAS,EAAC,QAAQ,EAAE,OAAO,CAAC,CAC7B,CAAC;AACJ,CAAC"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
"version": "7.9.0",
"version": "7.10.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"files": [
"dist",
@ -54,8 +54,8 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "7.9.0",
"@typescript-eslint/visitor-keys": "7.9.0",
"@typescript-eslint/types": "7.10.0",
"@typescript-eslint/visitor-keys": "7.10.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",

View file

@ -213,7 +213,6 @@ export declare namespace FlatConfig {
*/
sourceType?: SourceType;
}
type FileSpec = string | ((filePath: string) => boolean);
interface Config {
/**
* An string to identify the configuration object. Used in error messages and inspection tools.
@ -223,12 +222,12 @@ export declare namespace FlatConfig {
* An array of glob patterns indicating the files that the configuration object should apply to.
* If not specified, the configuration object applies to all files matched by any other configuration object.
*/
files?: (FileSpec | FileSpec[])[];
files?: (string | string[])[];
/**
* An array of glob patterns indicating the files that the configuration object should not apply to.
* If not specified, the configuration object applies to all files matched by files.
*/
ignores?: FileSpec[];
ignores?: string[];
/**
* An object containing settings related to how JavaScript is configured for linting.
*/

View file

@ -1 +1 @@
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/ts-eslint/Config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,KAAK,kBAAkB,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AAE/E,gBAAgB;AAChB,yBAAiB,YAAY,CAAC;IAC5B,KAAY,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,KAAY,cAAc,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IACtD,KAAY,SAAS,GAAG,QAAQ,GAAG,cAAc,CAAC;IAElD,KAAY,mBAAmB,GAAG,CAAC,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAE5D,KAAY,SAAS,GAAG,SAAS,GAAG,mBAAmB,CAAC;IACxD,KAAY,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IAE7D,KAAY,wBAAwB,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;IACvE,KAAY,oBAAoB,GAAG,wBAAwB,GAAG,OAAO,CAAC;IAEtE,UAAiB,aAAa;QAC5B,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAAC;KACtC;IACD,UAAiB,iBAAiB;QAChC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;KACzB;IAED,KAAY,aAAa,GAAG,kBAAkB,CAAC,aAAa,CAAC;IAE7D,UAAiB,UAAU;QACzB;;WAEG;Q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AQ,GACrB,YAAY,CAAC,cAAc,GAC3B,OAAO,CAAC;KACb;IAED,UAAiB,eAAe;QAC9B;;;;;WAKG;QACH,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B;;WAEG;QACH,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;QACpC;;;;;;;WAOG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;WAGG;QACH,aAAa,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;QAC1C;;;;;;;;;;WAUG;QACH,UAAU,CAAC,EAAE,UAAU,CAAC;KACzB;IAID,UAAiB,MAAM;QACrB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;;WAGG;QACH,KAAK,CAAC,EAAE,CACJ,MAAM,GAEN,MAAM,EAAE,CACX,EAAE,CAAC;QACJ;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB;;WAEG;QACH,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC;;WAEG;QACH,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B;;;WAGG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB;;;;WAIG;QACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC/B;;;WAGG;QACH,KAAK,CAAC,EAAE,KAAK,CAAC;QACd;;WAEG;QACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB;IACD,KAAY,WAAW,GAAG,MAAM,EAAE,CAAC;IACnC,KAAY,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACjD,KAAY,UAAU,GAAG,WAAW,GAAG,aAAa,CAAC;CACtD"}

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/utils",
"version": "7.9.0",
"version": "7.10.0",
"description": "Utilities for working with TypeScript + ESLint together",
"files": [
"dist",
@ -68,9 +68,9 @@
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "7.9.0",
"@typescript-eslint/types": "7.9.0",
"@typescript-eslint/typescript-estree": "7.9.0"
"@typescript-eslint/scope-manager": "7.10.0",
"@typescript-eslint/types": "7.10.0",
"@typescript-eslint/typescript-estree": "7.10.0"
},
"peerDependencies": {
"eslint": "^8.56.0"

View file

@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
"version": "7.9.0",
"version": "7.10.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"files": [
"dist",
@ -47,7 +47,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/types": "7.9.0",
"@typescript-eslint/types": "7.10.0",
"eslint-visitor-keys": "^3.4.3"
},
"devDependencies": {

17
node_modules/diff/CONTRIBUTING.md generated vendored
View file

@ -15,25 +15,22 @@ Generally we like to see pull requests that
## Building
```
npm install
npm test
yarn
yarn test
```
The `npm test -- dev` implements watching for tests within Node and `karma start` may be used for manual testing in browsers.
Running `yarn test -- dev` will watch for tests within Node and `karma start` may be used for manual testing in browsers.
If you notice any problems, please report them to the GitHub issue tracker at
[http://github.com/kpdecker/jsdiff/issues](http://github.com/kpdecker/jsdiff/issues).
## Releasing
JsDiff utilizes the [release yeoman generator][generator-release] to perform most release tasks.
A full release may be completed with the following:
```
yo release
npm publish
yarn clean
yarn grunt
yarn grunt uglify
yarn publish
```
[generator-release]: https://github.com/walmartlabs/generator-release
[pull-request]: https://github.com/kpdecker/jsdiff/pull/new/master

44
node_modules/diff/LICENSE generated vendored
View file

@ -1,31 +1,29 @@
Software License Agreement (BSD License)
BSD 3-Clause License
Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
All rights reserved.
Redistribution and use of this software in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Kevin Decker nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

218
node_modules/diff/README.md generated vendored
View file

@ -3,87 +3,113 @@
[![Build Status](https://secure.travis-ci.org/kpdecker/jsdiff.svg)](http://travis-ci.org/kpdecker/jsdiff)
[![Sauce Test Status](https://saucelabs.com/buildstatus/jsdiff)](https://saucelabs.com/u/jsdiff)
A javascript text differencing implementation.
A JavaScript text differencing implementation. Try it out in the **[online demo](https://kpdecker.github.io/jsdiff)**.
Based on the algorithm proposed in
["An O(ND) Difference Algorithm and its Variations" (Myers, 1986)](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927).
["An O(ND) Difference Algorithm and its Variations" (Myers, 1986)](http://www.xmailserver.org/diff2.pdf).
## Installation
```bash
npm install diff --save
```
## API
## Usage
* `Diff.diffChars(oldStr, newStr[, options])` - diffs two blocks of text, comparing character by character.
Broadly, jsdiff's diff functions all take an old text and a new text and perform three steps:
Returns a list of change objects (See below).
1. Split both texts into arrays of "tokens". What constitutes a token varies; in `diffChars`, each character is a token, while in `diffLines`, each line is a token.
2. Find the smallest set of single-token *insertions* and *deletions* needed to transform the first array of tokens into the second.
This step depends upon having some notion of a token from the old array being "equal" to one from the new array, and this notion of equality affects the results. Usually two tokens are equal if `===` considers them equal, but some of the diff functions use an alternative notion of equality or have options to configure it. For instance, by default `diffChars("Foo", "FOOD")` will require two deletions (`o`, `o`) and three insertions (`O`, `O`, `D`), but `diffChars("Foo", "FOOD", {ignoreCase: true})` will require just one insertion (of a `D`), since `ignoreCase` causes `o` and `O` to be considered equal.
3. Return an array representing the transformation computed in the previous step as a series of [change objects](#change-objects). The array is ordered from the start of the input to the end, and each change object represents *inserting* one or more tokens, *deleting* one or more tokens, or *keeping* one or more tokens.
### API
* `Diff.diffChars(oldStr, newStr[, options])` - diffs two blocks of text, treating each character as a token.
Returns a list of [change objects](#change-objects).
Options
* `ignoreCase`: `true` to ignore casing difference. Defaults to `false`.
* `ignoreCase`: If `true`, the uppercase and lowercase forms of a character are considered equal. Defaults to `false`.
* `Diff.diffWords(oldStr, newStr[, options])` - diffs two blocks of text, comparing word by word, ignoring whitespace.
* `Diff.diffWords(oldStr, newStr[, options])` - diffs two blocks of text, treating each word and each word separator (punctuation, newline, or run of whitespace) as a token.
Returns a list of change objects (See below).
(Whitespace-only tokens are automatically treated as equal to each other, so changes like changing a space to a newline or a run of multiple spaces will be ignored.)
Returns a list of [change objects](#change-objects).
Options
* `ignoreCase`: Same as in `diffChars`.
* `ignoreCase`: Same as in `diffChars`. Defaults to false.
* `Diff.diffWordsWithSpace(oldStr, newStr[, options])` - diffs two blocks of text, comparing word by word, treating whitespace as significant.
* `Diff.diffWordsWithSpace(oldStr, newStr[, options])` - same as `diffWords`, except whitespace-only tokens are not automatically considered equal, so e.g. changing a space to a tab is considered a change.
Returns a list of change objects (See below).
* `Diff.diffLines(oldStr, newStr[, options])` - diffs two blocks of text, comparing line by line.
* `Diff.diffLines(oldStr, newStr[, options])` - diffs two blocks of text, treating each line as a token.
Options
* `ignoreWhitespace`: `true` to ignore leading and trailing whitespace. This is the same as `diffTrimmedLines`
* `newlineIsToken`: `true` to treat newline characters as separate tokens. This allows for changes to the newline structure to occur independently of the line content and to be treated as such. In general this is the more human friendly form of `diffLines` and `diffLines` is better suited for patches and other computer friendly output.
* `ignoreWhitespace`: `true` to strip all leading and trailing whitespace characters from each line before performing the diff. Defaults to `false`.
* `stripTrailingCr`: `true` to remove all trailing CR (`\r`) characters before performing the diff. Defaults to `false`.
This helps to get a useful diff when diffing UNIX text files against Windows text files.
* `newlineIsToken`: `true` to treat the newline character at the end of each line as its own token. This allows for changes to the newline structure to occur independently of the line content and to be treated as such. In general this is the more human friendly form of `diffLines`; the default behavior with this option turned off is better suited for patches and other computer friendly output. Defaults to `false`.
Returns a list of change objects (See below).
Returns a list of [change objects](#change-objects).
* `Diff.diffTrimmedLines(oldStr, newStr[, options])` - diffs two blocks of text, comparing line by line, ignoring leading and trailing whitespace.
* `Diff.diffTrimmedLines(oldStr, newStr[, options])` - diffs two blocks of text, comparing line by line, after stripping leading and trailing whitespace. Equivalent to calling `diffLines` with `ignoreWhitespace: true`.
Returns a list of change objects (See below).
Options
* `stripTrailingCr`: Same as in `diffLines`. Defaults to `false`.
* `newlineIsToken`: Same as in `diffLines`. Defaults to `false`.
* `Diff.diffSentences(oldStr, newStr[, options])` - diffs two blocks of text, comparing sentence by sentence.
Returns a list of [change objects](#change-objects).
Returns a list of change objects (See below).
* `Diff.diffSentences(oldStr, newStr[, options])` - diffs two blocks of text, treating each sentence as a token.
Returns a list of [change objects](#change-objects).
* `Diff.diffCss(oldStr, newStr[, options])` - diffs two blocks of text, comparing CSS tokens.
Returns a list of change objects (See below).
Returns a list of [change objects](#change-objects).
* `Diff.diffJson(oldObj, newObj[, options])` - diffs two JSON objects, comparing the fields defined on each. The order of fields, etc does not matter in this comparison.
* `Diff.diffJson(oldObj, newObj[, options])` - diffs two JSON-serializable objects by first serializing them to prettily-formatted JSON and then treating each line of the JSON as a token. Object properties are ordered alphabetically in the serialized JSON, so the order of properties in the objects being compared doesn't affect the result.
Returns a list of change objects (See below).
Returns a list of [change objects](#change-objects).
Options
* `stringifyReplacer`: A custom replacer function. Operates similarly to the `replacer` parameter to [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter), but must be a function.
* `undefinedReplacement`: A value to replace `undefined` with. Ignored if a `stringifyReplacer` is provided.
* `Diff.diffArrays(oldArr, newArr[, options])` - diffs two arrays, comparing each item for strict equality (===).
* `Diff.diffArrays(oldArr, newArr[, options])` - diffs two arrays of tokens, comparing each item for strict equality (===).
Options
* `comparator`: `function(left, right)` for custom equality checks
Returns a list of change objects (See below).
Returns a list of [change objects](#change-objects).
* `Diff.createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader)` - creates a unified diff patch.
* `Diff.createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr[, oldHeader[, newHeader[, options]]])` - creates a unified diff patch by first computing a diff with `diffLines` and then serializing it to unified diff format.
Parameters:
* `oldFileName` : String to be output in the filename section of the patch for the removals
* `newFileName` : String to be output in the filename section of the patch for the additions
* `oldStr` : Original string value
* `newStr` : New string value
* `oldHeader` : Additional information to include in the old file header
* `newHeader` : Additional information to include in the new file header
* `oldHeader` : Optional additional information to include in the old file header. Default: `undefined`.
* `newHeader` : Optional additional information to include in the new file header. Default: `undefined`.
* `options` : An object with options.
- `context` describes how many lines of context should be included.
- `ignoreWhitespace`: `true` to ignore leading and trailing whitespace.
- `newlineIsToken`: `true` to treat newline characters as separate tokens. This allows for changes to the newline structure to occur independently of the line content and to be treated as such. In general this is the more human friendly form of `diffLines` and `diffLines` is better suited for patches and other computer friendly output.
- `context` describes how many lines of context should be included. You can set this to `Number.MAX_SAFE_INTEGER` or `Infinity` to include the entire file content in one hunk.
- `ignoreWhitespace`: Same as in `diffLines`. Defaults to `false`.
- `stripTrailingCr`: Same as in `diffLines`. Defaults to `false`.
- `newlineIsToken`: Same as in `diffLines`. Defaults to `false`.
* `Diff.createPatch(fileName, oldStr, newStr, oldHeader, newHeader)` - creates a unified diff patch.
* `Diff.createPatch(fileName, oldStr, newStr[, oldHeader[, newHeader[, options]]])` - creates a unified diff patch.
Just like Diff.createTwoFilesPatch, but with oldFileName being equal to newFileName.
* `Diff.formatPatch(patch)` - creates a unified diff patch.
* `Diff.structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options)` - returns an object with an array of hunk objects.
`patch` may be either a single structured patch object (as returned by `structuredPatch`) or an array of them (as returned by `parsePatch`).
* `Diff.structuredPatch(oldFileName, newFileName, oldStr, newStr[, oldHeader[, newHeader[, options]]])` - returns an object with an array of hunk objects.
This method is similar to createTwoFilesPatch, but returns a data structure
suitable for further processing. Parameters are the same as createTwoFilesPatch. The data structure returned may look like this:
@ -99,9 +125,11 @@ npm install diff --save
}
```
* `Diff.applyPatch(source, patch[, options])` - applies a unified diff patch.
* `Diff.applyPatch(source, patch[, options])` - attempts to apply a unified diff patch.
Return a string containing new version of provided data. `patch` may be a string diff or the output from the `parsePatch` or `structuredPatch` methods.
If the patch was applied successfully, returns a string containing the patched text. If the patch could not be applied (because some hunks in the patch couldn't be fitted to the text in `source`), returns false.
`patch` may be a string diff or the output from the `parsePatch` or `structuredPatch` methods.
The optional `options` object may have the following keys:
@ -110,6 +138,8 @@ npm install diff --save
* `Diff.applyPatches(patch, options)` - applies one or more patches.
`patch` may be either an array of structured patch objects, or a string representing a patch in unified diff format (which may patch one or more files).
This method will iterate over the contents of the patch and apply to data provided through callbacks. The general flow for each patch index is:
- `options.loadFile(index, callback)` is called. The caller should then load the contents of the file and then pass that to the `callback(err, data)` callback. Passing an `err` will terminate further patch execution.
@ -121,23 +151,56 @@ npm install diff --save
Return a JSON object representation of the a patch, suitable for use with the `applyPatch` method. This parses to the same structure returned by `Diff.structuredPatch`.
* `convertChangesToXML(changes)` - converts a list of changes to a serialized XML format
* `Diff.reversePatch(patch)` - Returns a new structured patch which when applied will undo the original `patch`.
`patch` may be either a single structured patch object (as returned by `structuredPatch`) or an array of them (as returned by `parsePatch`).
All methods above which accept the optional `callback` method will run in sync mode when that parameter is omitted and in async mode when supplied. This allows for larger diffs without blocking the event loop. This may be passed either directly as the final parameter or as the `callback` field in the `options` object.
* `Diff.convertChangesToXML(changes)` - converts a list of change objects to a serialized XML format
* `Diff.convertChangesToDMP(changes)` - converts a list of change objects to the format returned by Google's [diff-match-patch](https://github.com/google/diff-match-patch) library
#### Universal `options`
Certain options can be provided in the `options` object of *any* method that calculates a diff:
* `callback`: if provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated. The value of the `callback` option should be a function and will be passed the result of the diff as its second argument. The first argument will always be undefined. Only works with functions that return change objects, like `diffLines`, not those that return patches, like `structuredPatch` or `createPatch`.
(Note that if the ONLY option you want to provide is a callback, you can pass the callback function directly as the `options` parameter instead of passing an object with a `callback` property.)
* `maxEditLength`: a number specifying the maximum edit distance to consider between the old and new texts. If the edit distance is higher than this, jsdiff will return `undefined` instead of a diff. You can use this to limit the computational cost of diffing large, very different texts by giving up early if the cost will be huge. Works for functions that return change objects and also for `structuredPatch`, but not other patch-generation functions.
* `timeout`: a number of milliseconds after which the diffing algorithm will abort and return `undefined`. Supported by the same functions as `maxEditLength`.
### Defining custom diffing behaviors
If you need behavior a little different to what any of the text diffing functions above offer, you can roll your own by customizing both the tokenization behavior used and the notion of equality used to determine if two tokens are equal.
The simplest way to customize tokenization behavior is to simply tokenize the texts you want to diff yourself, with your own code, then pass the arrays of tokens to `diffArrays`. For instance, if you wanted a semantically-aware diff of some code, you could try tokenizing it using a parser specific to the programming language the code is in, then passing the arrays of tokens to `diffArrays`.
To customize the notion of token equality used, use the `comparator` option to `diffArrays`.
For even more customisation of the diffing behavior, you can create a `new Diff.Diff()` object, overwrite its `castInput`, `tokenize`, `removeEmpty`, `equals`, and `join` properties with your own functions, then call its `diff(oldString, newString[, options])` method. The methods you can overwrite are used as follows:
* `castInput(value)`: used to transform the `oldString` and `newString` before any other steps in the diffing algorithm happen. For instance, `diffJson` uses `castInput` to serialize the objects being diffed to JSON. Defaults to a no-op.
* `tokenize(value)`: used to convert each of `oldString` and `newString` (after they've gone through `castInput`) to an array of tokens. Defaults to returning `value.split('')` (returning an array of individual characters).
* `removeEmpty(array)`: called on the arrays of tokens returned by `tokenize` and can be used to modify them. Defaults to stripping out falsey tokens, such as empty strings. `diffArrays` overrides this to simply return the `array`, which means that falsey values like empty strings can be handled like any other token by `diffArrays`.
* `equals(left, right)`: called to determine if two tokens (one from the old string, one from the new string) should be considered equal. Defaults to comparing them with `===`.
* `join(tokens)`: gets called with an array of consecutive tokens that have either all been added, all been removed, or are all common. Needs to join them into a single value that can be used as the `value` property of the [change object](#change-objects) for these tokens. Defaults to simply returning `tokens.join('')`.
### Change Objects
Many of the methods above return change objects. These objects consist of the following fields:
* `value`: Text content
* `value`: The concatenated content of all the tokens represented by this change object - i.e. generally the text that is either added, deleted, or common, as a single string. In cases where tokens are considered common but are non-identical (e.g. because an option like `ignoreCase` or a custom `comparator` was used), the value from the *new* string will be provided here.
* `added`: True if the value was inserted into the new string
* `removed`: True if the value was removed from the old string
* `count`: How many tokens (e.g. chars for `diffChars`, lines for `diffLines`) the value in the change object consists of
(Change objects where `added` and `removed` are both falsey represent content that is common to the old and new strings.)
Note that some cases may omit a particular flag field. Comparison on the flag fields should always be done in a truthy or falsy manner.
## Examples
Basic example in Node
#### Basic example in Node
```js
require('colors');
@ -150,10 +213,10 @@ const diff = Diff.diffChars(one, other);
diff.forEach((part) => {
// green for additions, red for deletions
// grey for common parts
const color = part.added ? 'green' :
part.removed ? 'red' : 'grey';
process.stderr.write(part.value[color]);
let text = part.added ? part.value.bgGreen :
part.removed ? part.value.bgRed :
part.value;
process.stderr.write(text);
});
console.log();
@ -162,7 +225,7 @@ Running the above program should yield
<img src="images/node_example.png" alt="Node Example">
Basic example in a web page
#### Basic example in a web page
```html
<pre id="display"></pre>
@ -198,7 +261,65 @@ Open the above .html file in a browser and you should see
<img src="images/web_example.png" alt="Node Example">
**[Full online demo](https://kpdecker.github.io/jsdiff)**
#### Example of generating a patch from Node
The code below is roughly equivalent to the Unix command `diff -u file1.txt file2.txt > mydiff.patch`:
```
const Diff = require('diff');
const file1Contents = fs.readFileSync("file1.txt").toString();
const file2Contents = fs.readFileSync("file2.txt").toString();
const patch = Diff.createTwoFilesPatch("file1.txt", "file2.txt", file1Contents, file2Contents);
fs.writeFileSync("mydiff.patch", patch);
```
#### Examples of parsing and applying a patch from Node
##### Applying a patch to a specified file
The code below is roughly equivalent to the Unix command `patch file1.txt mydiff.patch`:
```
const Diff = require('diff');
const file1Contents = fs.readFileSync("file1.txt").toString();
const patch = fs.readFileSync("mydiff.patch").toString();
const patchedFile = Diff.applyPatch(file1Contents, patch);
fs.writeFileSync("file1.txt", patchedFile);
```
##### Applying a multi-file patch to the files specified by the patch file itself
The code below is roughly equivalent to the Unix command `patch < mydiff.patch`:
```
const Diff = require('diff');
const patch = fs.readFileSync("mydiff.patch").toString();
Diff.applyPatches(patch, {
loadFile: (patch, callback) => {
let fileContents;
try {
fileContents = fs.readFileSync(patch.oldFileName).toString();
} catch (e) {
callback(`No such file: ${patch.oldFileName}`);
return;
}
callback(undefined, fileContents);
},
patched: (patch, patchedContent, callback) => {
if (patchedContent === false) {
callback(`Failed to apply patch to ${patch.oldFileName}`)
return;
}
fs.writeFileSync(patch.oldFileName, patchedContent);
callback();
},
complete: (err) => {
if (err) {
console.log("Failed with error:", err);
}
}
});
```
## Compatibility
@ -209,3 +330,10 @@ jsdiff supports all ES3 environments with some known issues on IE8 and below. Un
## License
See [LICENSE](https://github.com/kpdecker/jsdiff/blob/master/LICENSE).
## Deviations from the published Myers diff algorithm
jsdiff deviates from the published algorithm in a couple of ways that don't affect results but do affect performance:
* jsdiff keeps track of the diff for each diagonal using a linked list of change objects for each diagonal, rather than the historical array of furthest-reaching D-paths on each diagonal contemplated on page 8 of Myers's paper.
* jsdiff skips considering diagonals where the furthest-reaching D-path would go off the edge of the edit graph. This dramatically reduces the time cost (from quadratic to linear) in cases where the new text just appends or truncates content at the end of the old text.

295
node_modules/diff/dist/diff.js generated vendored
View file

@ -1,40 +1,3 @@
/*!
diff v5.1.0
Software License Agreement (BSD License)
Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
All rights reserved.
Redistribution and use of this software in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of Kevin Decker nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@license
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
@ -44,6 +7,8 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
function Diff() {}
Diff.prototype = {
diff: function diff(oldString, newString) {
var _options$timeout;
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var callback = options.callback;
@ -80,64 +45,96 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
}
var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
var abortAfterTimestamp = Date.now() + maxExecutionTime;
var bestPath = [{
newPos: -1,
components: []
oldPos: -1,
lastComponent: undefined
}]; // Seed editLength = 0, i.e. the content starts with the same values
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
var newPos = this.extractCommon(bestPath[0], newString, oldString, 0);
if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
// Identity per the equality and tokenizer
return done([{
value: this.join(newString),
count: newString.length
}]);
} // Main worker method. checks all permutations of a given edit length for acceptance.
} // Once we hit the right edge of the edit graph on some diagonal k, we can
// definitely reach the end of the edit graph in no more than k edits, so
// there's no point in considering any moves to diagonal k+1 any more (from
// which we're guaranteed to need at least k+1 more edits).
// Similarly, once we've reached the bottom of the edit graph, there's no
// point considering moves to lower diagonals.
// We record this fact by setting minDiagonalToConsider and
// maxDiagonalToConsider to some finite value once we've hit the edge of
// the edit graph.
// This optimization is not faithful to the original algorithm presented in
// Myers's paper, which instead pointlessly extends D-paths off the end of
// the edit graph - see page 7 of Myers's paper which notes this point
// explicitly and illustrates it with a diagram. This has major performance
// implications for some common scenarios. For instance, to compute a diff
// where the new text simply appends d characters on the end of the
// original text of length n, the true Myers algorithm will take O(n+d^2)
// time while this optimization needs only O(n+d) time.
var minDiagonalToConsider = -Infinity,
maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance.
function execEditLength() {
for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
var basePath = void 0;
var removePath = bestPath[diagonalPath - 1],
addPath = bestPath[diagonalPath + 1];
var addPath = bestPath[diagonalPath - 1],
removePath = bestPath[diagonalPath + 1],
_oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
if (addPath) {
if (removePath) {
// No one else is going to attempt to use this value, clear it
bestPath[diagonalPath - 1] = undefined;
}
var canAdd = addPath && addPath.newPos + 1 < newLen,
canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
var canAdd = false;
if (addPath) {
// what newPos will be after we do an insertion:
var addPathNewPos = addPath.oldPos - diagonalPath;
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
}
var canRemove = removePath && removePath.oldPos + 1 < oldLen;
if (!canAdd && !canRemove) {
// If this path is a terminal then prune
bestPath[diagonalPath] = undefined;
continue;
} // Select the diagonal that we want to branch from. We select the prior
// path whose position in the new string is the farthest from the origin
// path whose position in the old string is the farthest from the origin
// and does not pass the bounds of the diff graph
// TODO: Remove the `+ 1` here to make behavior match Myers algorithm
// and prefer to order removals before insertions.
if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
basePath = clonePath(removePath);
self.pushComponent(basePath.components, undefined, true);
if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) {
basePath = self.addToPath(addPath, true, undefined, 0);
} else {
basePath = addPath; // No need to clone, we've pulled it from the list
basePath.newPos++;
self.pushComponent(basePath.components, true, undefined);
basePath = self.addToPath(removePath, undefined, true, 1);
}
_oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
newPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
// If we have hit the end of both strings, then we are done
return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
} else {
// Otherwise track this path as a potential candidate and continue.
bestPath[diagonalPath] = basePath;
if (basePath.oldPos + 1 >= oldLen) {
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
}
if (newPos + 1 >= newLen) {
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
}
}
}
@ -151,7 +148,7 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if (callback) {
(function exec() {
setTimeout(function () {
if (editLength > maxEditLength) {
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
return callback();
}
@ -161,7 +158,7 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}, 0);
})();
} else {
while (editLength <= maxEditLength) {
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
var ret = execEditLength();
if (ret) {
@ -170,30 +167,36 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
}
},
pushComponent: function pushComponent(components, added, removed) {
var last = components[components.length - 1];
addToPath: function addToPath(path, added, removed, oldPosInc) {
var last = path.lastComponent;
if (last && last.added === added && last.removed === removed) {
// We need to clone here as the component clone operation is just
// as shallow array clone
components[components.length - 1] = {
count: last.count + 1,
added: added,
removed: removed
return {
oldPos: path.oldPos + oldPosInc,
lastComponent: {
count: last.count + 1,
added: added,
removed: removed,
previousComponent: last.previousComponent
}
};
} else {
components.push({
count: 1,
added: added,
removed: removed
});
return {
oldPos: path.oldPos + oldPosInc,
lastComponent: {
count: 1,
added: added,
removed: removed,
previousComponent: last
}
};
}
},
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
var newLen = newString.length,
oldLen = oldString.length,
newPos = basePath.newPos,
oldPos = newPos - diagonalPath,
oldPos = basePath.oldPos,
newPos = oldPos - diagonalPath,
commonCount = 0;
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
@ -203,13 +206,14 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
if (commonCount) {
basePath.components.push({
count: commonCount
});
basePath.lastComponent = {
count: commonCount,
previousComponent: basePath.lastComponent
};
}
basePath.newPos = newPos;
return oldPos;
basePath.oldPos = oldPos;
return newPos;
},
equals: function equals(left, right) {
if (this.options.comparator) {
@ -240,7 +244,20 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
};
function buildValues(diff, components, newString, oldString, useLongestToken) {
function buildValues(diff, lastComponent, newString, oldString, useLongestToken) {
// First we convert our linked list of components in reverse order to an
// array in the right order:
var components = [];
var nextComponent;
while (lastComponent) {
components.push(lastComponent);
nextComponent = lastComponent.previousComponent;
delete lastComponent.previousComponent;
lastComponent = nextComponent;
}
components.reverse();
var componentPos = 0,
componentLen = components.length,
newPos = 0,
@ -283,23 +300,16 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This is only available for string mode.
var lastComponent = components[componentLen - 1];
var finalComponent = components[componentLen - 1];
if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
components[componentLen - 2].value += lastComponent.value;
if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) {
components[componentLen - 2].value += finalComponent.value;
components.pop();
}
return components;
}
function clonePath(path) {
return {
newPos: path.newPos,
components: path.components.slice(0)
};
}
var characterDiff = new Diff();
function diffChars(oldStr, newStr, options) {
return characterDiff.diff(oldStr, newStr, options);
@ -380,6 +390,11 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var lineDiff = new Diff();
lineDiff.tokenize = function (value) {
if (this.options.stripTrailingCr) {
// remove one \r before \n to match GNU diff's --strip-trailing-cr behavior
value = value.replace(/\r\n/g, '\n');
}
var retLines = [],
linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
@ -451,6 +466,55 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
return _typeof(obj);
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
@ -883,7 +947,7 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var line = _hunk.lines[j],
operation = line.length > 0 ? line[0] : ' ',
content = line.length > 0 ? line.substr(1) : line,
delimiter = _hunk.linedelimiters[j];
delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n';
if (operation === ' ') {
_toPos++;
@ -1090,6 +1154,10 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
};
}
function formatPatch(diff) {
if (Array.isArray(diff)) {
return diff.map(formatPatch).join('\n');
}
var ret = [];
if (diff.oldFileName == diff.newFileName) {
@ -1545,6 +1613,39 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
};
}
function reversePatch(structuredPatch) {
if (Array.isArray(structuredPatch)) {
return structuredPatch.map(reversePatch).reverse();
}
return _objectSpread2(_objectSpread2({}, structuredPatch), {}, {
oldFileName: structuredPatch.newFileName,
oldHeader: structuredPatch.newHeader,
newFileName: structuredPatch.oldFileName,
newHeader: structuredPatch.oldHeader,
hunks: structuredPatch.hunks.map(function (hunk) {
return {
oldLines: hunk.newLines,
oldStart: hunk.newStart,
newLines: hunk.oldLines,
newStart: hunk.oldStart,
linedelimiters: hunk.linedelimiters,
lines: hunk.lines.map(function (l) {
if (l.startsWith('-')) {
return "+".concat(l.slice(1));
}
if (l.startsWith('+')) {
return "-".concat(l.slice(1));
}
return l;
})
};
})
});
}
// See: http://code.google.com/p/google-diff-match-patch/wiki/API
function convertChangesToDMP(changes) {
var ret = [],
@ -1618,8 +1719,10 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
exports.diffTrimmedLines = diffTrimmedLines;
exports.diffWords = diffWords;
exports.diffWordsWithSpace = diffWordsWithSpace;
exports.formatPatch = formatPatch;
exports.merge = merge;
exports.parsePatch = parsePatch;
exports.reversePatch = reversePatch;
exports.structuredPatch = structuredPatch;
Object.defineProperty(exports, '__esModule', { value: true });

39
node_modules/diff/dist/diff.min.js generated vendored

File diff suppressed because one or more lines are too long

169
node_modules/diff/lib/diff/base.js generated vendored

File diff suppressed because one or more lines are too long

7
node_modules/diff/lib/diff/line.js generated vendored
View file

@ -39,6 +39,11 @@ exports.lineDiff = lineDiff;
/*istanbul ignore end*/
lineDiff.tokenize = function (value) {
if (this.options.stripTrailingCr) {
// remove one \r before \n to match GNU diff's --strip-trailing-cr behavior
value = value.replace(/\r\n/g, '\n');
}
var retLines = [],
linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
@ -86,4 +91,4 @@ function diffTrimmedLines(oldStr, newStr, callback) {
});
return lineDiff.diff(oldStr, newStr, options);
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjoz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5leHBvcnQgZnVuY3Rpb24gZGlmZkxpbmVzKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjaykgeyByZXR1cm4gbGluZURpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spOyB9XG5leHBvcnQgZnVuY3Rpb24gZGlmZlRyaW1tZWRMaW5lcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHtcbiAgbGV0IG9wdGlvbnMgPSBnZW5lcmF0ZU9wdGlvbnMoY2FsbGJhY2ssIHtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiBsaW5lRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cbiJdfQ==

258
node_modules/diff/lib/index.es6.js generated vendored
View file

@ -1,6 +1,8 @@
function Diff() {}
Diff.prototype = {
diff: function diff(oldString, newString) {
var _options$timeout;
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var callback = options.callback;
@ -37,64 +39,96 @@ Diff.prototype = {
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
}
var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
var abortAfterTimestamp = Date.now() + maxExecutionTime;
var bestPath = [{
newPos: -1,
components: []
oldPos: -1,
lastComponent: undefined
}]; // Seed editLength = 0, i.e. the content starts with the same values
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
var newPos = this.extractCommon(bestPath[0], newString, oldString, 0);
if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
// Identity per the equality and tokenizer
return done([{
value: this.join(newString),
count: newString.length
}]);
} // Main worker method. checks all permutations of a given edit length for acceptance.
} // Once we hit the right edge of the edit graph on some diagonal k, we can
// definitely reach the end of the edit graph in no more than k edits, so
// there's no point in considering any moves to diagonal k+1 any more (from
// which we're guaranteed to need at least k+1 more edits).
// Similarly, once we've reached the bottom of the edit graph, there's no
// point considering moves to lower diagonals.
// We record this fact by setting minDiagonalToConsider and
// maxDiagonalToConsider to some finite value once we've hit the edge of
// the edit graph.
// This optimization is not faithful to the original algorithm presented in
// Myers's paper, which instead pointlessly extends D-paths off the end of
// the edit graph - see page 7 of Myers's paper which notes this point
// explicitly and illustrates it with a diagram. This has major performance
// implications for some common scenarios. For instance, to compute a diff
// where the new text simply appends d characters on the end of the
// original text of length n, the true Myers algorithm will take O(n+d^2)
// time while this optimization needs only O(n+d) time.
var minDiagonalToConsider = -Infinity,
maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance.
function execEditLength() {
for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
var basePath = void 0;
var removePath = bestPath[diagonalPath - 1],
addPath = bestPath[diagonalPath + 1];
var addPath = bestPath[diagonalPath - 1],
removePath = bestPath[diagonalPath + 1],
_oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
if (addPath) {
if (removePath) {
// No one else is going to attempt to use this value, clear it
bestPath[diagonalPath - 1] = undefined;
}
var canAdd = addPath && addPath.newPos + 1 < newLen,
canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
var canAdd = false;
if (addPath) {
// what newPos will be after we do an insertion:
var addPathNewPos = addPath.oldPos - diagonalPath;
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
}
var canRemove = removePath && removePath.oldPos + 1 < oldLen;
if (!canAdd && !canRemove) {
// If this path is a terminal then prune
bestPath[diagonalPath] = undefined;
continue;
} // Select the diagonal that we want to branch from. We select the prior
// path whose position in the new string is the farthest from the origin
// path whose position in the old string is the farthest from the origin
// and does not pass the bounds of the diff graph
// TODO: Remove the `+ 1` here to make behavior match Myers algorithm
// and prefer to order removals before insertions.
if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
basePath = clonePath(removePath);
self.pushComponent(basePath.components, undefined, true);
if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) {
basePath = self.addToPath(addPath, true, undefined, 0);
} else {
basePath = addPath; // No need to clone, we've pulled it from the list
basePath.newPos++;
self.pushComponent(basePath.components, true, undefined);
basePath = self.addToPath(removePath, undefined, true, 1);
}
_oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
newPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
// If we have hit the end of both strings, then we are done
return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
} else {
// Otherwise track this path as a potential candidate and continue.
bestPath[diagonalPath] = basePath;
if (basePath.oldPos + 1 >= oldLen) {
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
}
if (newPos + 1 >= newLen) {
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
}
}
}
@ -108,7 +142,7 @@ Diff.prototype = {
if (callback) {
(function exec() {
setTimeout(function () {
if (editLength > maxEditLength) {
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
return callback();
}
@ -118,7 +152,7 @@ Diff.prototype = {
}, 0);
})();
} else {
while (editLength <= maxEditLength) {
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
var ret = execEditLength();
if (ret) {
@ -127,30 +161,36 @@ Diff.prototype = {
}
}
},
pushComponent: function pushComponent(components, added, removed) {
var last = components[components.length - 1];
addToPath: function addToPath(path, added, removed, oldPosInc) {
var last = path.lastComponent;
if (last && last.added === added && last.removed === removed) {
// We need to clone here as the component clone operation is just
// as shallow array clone
components[components.length - 1] = {
count: last.count + 1,
added: added,
removed: removed
return {
oldPos: path.oldPos + oldPosInc,
lastComponent: {
count: last.count + 1,
added: added,
removed: removed,
previousComponent: last.previousComponent
}
};
} else {
components.push({
count: 1,
added: added,
removed: removed
});
return {
oldPos: path.oldPos + oldPosInc,
lastComponent: {
count: 1,
added: added,
removed: removed,
previousComponent: last
}
};
}
},
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
var newLen = newString.length,
oldLen = oldString.length,
newPos = basePath.newPos,
oldPos = newPos - diagonalPath,
oldPos = basePath.oldPos,
newPos = oldPos - diagonalPath,
commonCount = 0;
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
@ -160,13 +200,14 @@ Diff.prototype = {
}
if (commonCount) {
basePath.components.push({
count: commonCount
});
basePath.lastComponent = {
count: commonCount,
previousComponent: basePath.lastComponent
};
}
basePath.newPos = newPos;
return oldPos;
basePath.oldPos = oldPos;
return newPos;
},
equals: function equals(left, right) {
if (this.options.comparator) {
@ -197,7 +238,20 @@ Diff.prototype = {
}
};
function buildValues(diff, components, newString, oldString, useLongestToken) {
function buildValues(diff, lastComponent, newString, oldString, useLongestToken) {
// First we convert our linked list of components in reverse order to an
// array in the right order:
var components = [];
var nextComponent;
while (lastComponent) {
components.push(lastComponent);
nextComponent = lastComponent.previousComponent;
delete lastComponent.previousComponent;
lastComponent = nextComponent;
}
components.reverse();
var componentPos = 0,
componentLen = components.length,
newPos = 0,
@ -240,23 +294,16 @@ function buildValues(diff, components, newString, oldString, useLongestToken) {
// This is only available for string mode.
var lastComponent = components[componentLen - 1];
var finalComponent = components[componentLen - 1];
if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
components[componentLen - 2].value += lastComponent.value;
if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) {
components[componentLen - 2].value += finalComponent.value;
components.pop();
}
return components;
}
function clonePath(path) {
return {
newPos: path.newPos,
components: path.components.slice(0)
};
}
var characterDiff = new Diff();
function diffChars(oldStr, newStr, options) {
return characterDiff.diff(oldStr, newStr, options);
@ -337,6 +384,11 @@ function diffWordsWithSpace(oldStr, newStr, options) {
var lineDiff = new Diff();
lineDiff.tokenize = function (value) {
if (this.options.stripTrailingCr) {
// remove one \r before \n to match GNU diff's --strip-trailing-cr behavior
value = value.replace(/\r\n/g, '\n');
}
var retLines = [],
linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
@ -408,6 +460,55 @@ function _typeof(obj) {
return _typeof(obj);
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
@ -840,7 +941,7 @@ function applyPatch(source, uniDiff) {
var line = _hunk.lines[j],
operation = line.length > 0 ? line[0] : ' ',
content = line.length > 0 ? line.substr(1) : line,
delimiter = _hunk.linedelimiters[j];
delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n';
if (operation === ' ') {
_toPos++;
@ -1047,6 +1148,10 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
};
}
function formatPatch(diff) {
if (Array.isArray(diff)) {
return diff.map(formatPatch).join('\n');
}
var ret = [];
if (diff.oldFileName == diff.newFileName) {
@ -1502,6 +1607,39 @@ function calcOldNewLineCount(lines) {
};
}
function reversePatch(structuredPatch) {
if (Array.isArray(structuredPatch)) {
return structuredPatch.map(reversePatch).reverse();
}
return _objectSpread2(_objectSpread2({}, structuredPatch), {}, {
oldFileName: structuredPatch.newFileName,
oldHeader: structuredPatch.newHeader,
newFileName: structuredPatch.oldFileName,
newHeader: structuredPatch.oldHeader,
hunks: structuredPatch.hunks.map(function (hunk) {
return {
oldLines: hunk.newLines,
oldStart: hunk.newStart,
newLines: hunk.oldLines,
newStart: hunk.oldStart,
linedelimiters: hunk.linedelimiters,
lines: hunk.lines.map(function (l) {
if (l.startsWith('-')) {
return "+".concat(l.slice(1));
}
if (l.startsWith('+')) {
return "-".concat(l.slice(1));
}
return l;
})
};
})
});
}
// See: http://code.google.com/p/google-diff-match-patch/wiki/API
function convertChangesToDMP(changes) {
var ret = [],
@ -1558,4 +1696,4 @@ function escapeHTML(s) {
return n;
}
export { Diff, applyPatch, applyPatches, canonicalize, convertChangesToDMP, convertChangesToXML, createPatch, createTwoFilesPatch, diffArrays, diffChars, diffCss, diffJson, diffLines, diffSentences, diffTrimmedLines, diffWords, diffWordsWithSpace, merge, parsePatch, structuredPatch };
export { Diff, applyPatch, applyPatches, canonicalize, convertChangesToDMP, convertChangesToXML, createPatch, createTwoFilesPatch, diffArrays, diffChars, diffCss, diffJson, diffLines, diffSentences, diffTrimmedLines, diffWords, diffWordsWithSpace, formatPatch, merge, parsePatch, reversePatch, structuredPatch };

20
node_modules/diff/lib/index.js generated vendored
View file

@ -94,6 +94,12 @@ Object.defineProperty(exports, "merge", {
return _merge.merge;
}
});
Object.defineProperty(exports, "reversePatch", {
enumerable: true,
get: function get() {
return _reverse.reversePatch;
}
});
Object.defineProperty(exports, "structuredPatch", {
enumerable: true,
get: function get() {
@ -112,6 +118,12 @@ Object.defineProperty(exports, "createPatch", {
return _create.createPatch;
}
});
Object.defineProperty(exports, "formatPatch", {
enumerable: true,
get: function get() {
return _create.formatPatch;
}
});
Object.defineProperty(exports, "convertChangesToDMP", {
enumerable: true,
get: function get() {
@ -192,6 +204,12 @@ _merge = require("./patch/merge")
/*istanbul ignore end*/
;
var
/*istanbul ignore start*/
_reverse = require("./patch/reverse")
/*istanbul ignore end*/
;
var
/*istanbul ignore start*/
_create = require("./patch/create")
@ -213,4 +231,4 @@ _xml = require("./convert/xml")
/*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/*istanbul ignore end*/
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQWdCQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTs7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBRUE7QUFBQTtBQUFBO0FBQUE7QUFBQTs7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUVBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBRUE7QUFBQTtBQUFBO0FBQUE7QU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VyZWRQYXRjaCxcbiAgY3JlYXRlVHdvRmlsZXNQYXRjaCxcbiAgY3JlYXRlUGF0Y2gsXG4gIGZvcm1hdFBhdGNoLFxuICBhcHBseVBhdGNoLFxuICBhcHBseVBhdGNoZXMsXG4gIHBhcnNlUGF0Y2gsXG4gIG1lcmdlLFxuICByZXZlcnNlUGF0Y2gsXG4gIGNvbnZlcnRDaGFuZ2VzVG9ETVAsXG4gIGNvbnZlcnRDaGFuZ2VzVG9YTUwsXG4gIGNhbm9uaWNhbGl6ZVxufTtcbiJdfQ==

258
node_modules/diff/lib/index.mjs generated vendored
View file

@ -1,6 +1,8 @@
function Diff() {}
Diff.prototype = {
diff: function diff(oldString, newString) {
var _options$timeout;
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var callback = options.callback;
@ -37,64 +39,96 @@ Diff.prototype = {
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
}
var maxExecutionTime = (_options$timeout = options.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
var abortAfterTimestamp = Date.now() + maxExecutionTime;
var bestPath = [{
newPos: -1,
components: []
oldPos: -1,
lastComponent: undefined
}]; // Seed editLength = 0, i.e. the content starts with the same values
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
var newPos = this.extractCommon(bestPath[0], newString, oldString, 0);
if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
// Identity per the equality and tokenizer
return done([{
value: this.join(newString),
count: newString.length
}]);
} // Main worker method. checks all permutations of a given edit length for acceptance.
} // Once we hit the right edge of the edit graph on some diagonal k, we can
// definitely reach the end of the edit graph in no more than k edits, so
// there's no point in considering any moves to diagonal k+1 any more (from
// which we're guaranteed to need at least k+1 more edits).
// Similarly, once we've reached the bottom of the edit graph, there's no
// point considering moves to lower diagonals.
// We record this fact by setting minDiagonalToConsider and
// maxDiagonalToConsider to some finite value once we've hit the edge of
// the edit graph.
// This optimization is not faithful to the original algorithm presented in
// Myers's paper, which instead pointlessly extends D-paths off the end of
// the edit graph - see page 7 of Myers's paper which notes this point
// explicitly and illustrates it with a diagram. This has major performance
// implications for some common scenarios. For instance, to compute a diff
// where the new text simply appends d characters on the end of the
// original text of length n, the true Myers algorithm will take O(n+d^2)
// time while this optimization needs only O(n+d) time.
var minDiagonalToConsider = -Infinity,
maxDiagonalToConsider = Infinity; // Main worker method. checks all permutations of a given edit length for acceptance.
function execEditLength() {
for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
var basePath = void 0;
var removePath = bestPath[diagonalPath - 1],
addPath = bestPath[diagonalPath + 1];
var addPath = bestPath[diagonalPath - 1],
removePath = bestPath[diagonalPath + 1],
_oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
if (addPath) {
if (removePath) {
// No one else is going to attempt to use this value, clear it
bestPath[diagonalPath - 1] = undefined;
}
var canAdd = addPath && addPath.newPos + 1 < newLen,
canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
var canAdd = false;
if (addPath) {
// what newPos will be after we do an insertion:
var addPathNewPos = addPath.oldPos - diagonalPath;
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
}
var canRemove = removePath && removePath.oldPos + 1 < oldLen;
if (!canAdd && !canRemove) {
// If this path is a terminal then prune
bestPath[diagonalPath] = undefined;
continue;
} // Select the diagonal that we want to branch from. We select the prior
// path whose position in the new string is the farthest from the origin
// path whose position in the old string is the farthest from the origin
// and does not pass the bounds of the diff graph
// TODO: Remove the `+ 1` here to make behavior match Myers algorithm
// and prefer to order removals before insertions.
if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
basePath = clonePath(removePath);
self.pushComponent(basePath.components, undefined, true);
if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) {
basePath = self.addToPath(addPath, true, undefined, 0);
} else {
basePath = addPath; // No need to clone, we've pulled it from the list
basePath.newPos++;
self.pushComponent(basePath.components, true, undefined);
basePath = self.addToPath(removePath, undefined, true, 1);
}
_oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
newPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
// If we have hit the end of both strings, then we are done
return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
} else {
// Otherwise track this path as a potential candidate and continue.
bestPath[diagonalPath] = basePath;
if (basePath.oldPos + 1 >= oldLen) {
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
}
if (newPos + 1 >= newLen) {
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
}
}
}
@ -108,7 +142,7 @@ Diff.prototype = {
if (callback) {
(function exec() {
setTimeout(function () {
if (editLength > maxEditLength) {
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
return callback();
}
@ -118,7 +152,7 @@ Diff.prototype = {
}, 0);
})();
} else {
while (editLength <= maxEditLength) {
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
var ret = execEditLength();
if (ret) {
@ -127,30 +161,36 @@ Diff.prototype = {
}
}
},
pushComponent: function pushComponent(components, added, removed) {
var last = components[components.length - 1];
addToPath: function addToPath(path, added, removed, oldPosInc) {
var last = path.lastComponent;
if (last && last.added === added && last.removed === removed) {
// We need to clone here as the component clone operation is just
// as shallow array clone
components[components.length - 1] = {
count: last.count + 1,
added: added,
removed: removed
return {
oldPos: path.oldPos + oldPosInc,
lastComponent: {
count: last.count + 1,
added: added,
removed: removed,
previousComponent: last.previousComponent
}
};
} else {
components.push({
count: 1,
added: added,
removed: removed
});
return {
oldPos: path.oldPos + oldPosInc,
lastComponent: {
count: 1,
added: added,
removed: removed,
previousComponent: last
}
};
}
},
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
var newLen = newString.length,
oldLen = oldString.length,
newPos = basePath.newPos,
oldPos = newPos - diagonalPath,
oldPos = basePath.oldPos,
newPos = oldPos - diagonalPath,
commonCount = 0;
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
@ -160,13 +200,14 @@ Diff.prototype = {
}
if (commonCount) {
basePath.components.push({
count: commonCount
});
basePath.lastComponent = {
count: commonCount,
previousComponent: basePath.lastComponent
};
}
basePath.newPos = newPos;
return oldPos;
basePath.oldPos = oldPos;
return newPos;
},
equals: function equals(left, right) {
if (this.options.comparator) {
@ -197,7 +238,20 @@ Diff.prototype = {
}
};
function buildValues(diff, components, newString, oldString, useLongestToken) {
function buildValues(diff, lastComponent, newString, oldString, useLongestToken) {
// First we convert our linked list of components in reverse order to an
// array in the right order:
var components = [];
var nextComponent;
while (lastComponent) {
components.push(lastComponent);
nextComponent = lastComponent.previousComponent;
delete lastComponent.previousComponent;
lastComponent = nextComponent;
}
components.reverse();
var componentPos = 0,
componentLen = components.length,
newPos = 0,
@ -240,23 +294,16 @@ function buildValues(diff, components, newString, oldString, useLongestToken) {
// This is only available for string mode.
var lastComponent = components[componentLen - 1];
var finalComponent = components[componentLen - 1];
if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
components[componentLen - 2].value += lastComponent.value;
if (componentLen > 1 && typeof finalComponent.value === 'string' && (finalComponent.added || finalComponent.removed) && diff.equals('', finalComponent.value)) {
components[componentLen - 2].value += finalComponent.value;
components.pop();
}
return components;
}
function clonePath(path) {
return {
newPos: path.newPos,
components: path.components.slice(0)
};
}
var characterDiff = new Diff();
function diffChars(oldStr, newStr, options) {
return characterDiff.diff(oldStr, newStr, options);
@ -337,6 +384,11 @@ function diffWordsWithSpace(oldStr, newStr, options) {
var lineDiff = new Diff();
lineDiff.tokenize = function (value) {
if (this.options.stripTrailingCr) {
// remove one \r before \n to match GNU diff's --strip-trailing-cr behavior
value = value.replace(/\r\n/g, '\n');
}
var retLines = [],
linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
@ -408,6 +460,55 @@ function _typeof(obj) {
return _typeof(obj);
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
@ -840,7 +941,7 @@ function applyPatch(source, uniDiff) {
var line = _hunk.lines[j],
operation = line.length > 0 ? line[0] : ' ',
content = line.length > 0 ? line.substr(1) : line,
delimiter = _hunk.linedelimiters[j];
delimiter = _hunk.linedelimiters && _hunk.linedelimiters[j] || '\n';
if (operation === ' ') {
_toPos++;
@ -1047,6 +1148,10 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
};
}
function formatPatch(diff) {
if (Array.isArray(diff)) {
return diff.map(formatPatch).join('\n');
}
var ret = [];
if (diff.oldFileName == diff.newFileName) {
@ -1502,6 +1607,39 @@ function calcOldNewLineCount(lines) {
};
}
function reversePatch(structuredPatch) {
if (Array.isArray(structuredPatch)) {
return structuredPatch.map(reversePatch).reverse();
}
return _objectSpread2(_objectSpread2({}, structuredPatch), {}, {
oldFileName: structuredPatch.newFileName,
oldHeader: structuredPatch.newHeader,
newFileName: structuredPatch.oldFileName,
newHeader: structuredPatch.oldHeader,
hunks: structuredPatch.hunks.map(function (hunk) {
return {
oldLines: hunk.newLines,
oldStart: hunk.newStart,
newLines: hunk.oldLines,
newStart: hunk.oldStart,
linedelimiters: hunk.linedelimiters,
lines: hunk.lines.map(function (l) {
if (l.startsWith('-')) {
return "+".concat(l.slice(1));
}
if (l.startsWith('+')) {
return "-".concat(l.slice(1));
}
return l;
})
};
})
});
}
// See: http://code.google.com/p/google-diff-match-patch/wiki/API
function convertChangesToDMP(changes) {
var ret = [],
@ -1558,4 +1696,4 @@ function escapeHTML(s) {
return n;
}
export { Diff, applyPatch, applyPatches, canonicalize, convertChangesToDMP, convertChangesToXML, createPatch, createTwoFilesPatch, diffArrays, diffChars, diffCss, diffJson, diffLines, diffSentences, diffTrimmedLines, diffWords, diffWordsWithSpace, merge, parsePatch, structuredPatch };
export { Diff, applyPatch, applyPatches, canonicalize, convertChangesToDMP, convertChangesToXML, createPatch, createTwoFilesPatch, diffArrays, diffChars, diffCss, diffJson, diffLines, diffSentences, diffTrimmedLines, diffWords, diffWordsWithSpace, formatPatch, merge, parsePatch, reversePatch, structuredPatch };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

63
node_modules/diff/lib/patch/reverse.js generated vendored Normal file
View file

@ -0,0 +1,63 @@
/*istanbul ignore start*/
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.reversePatch = reversePatch;
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/*istanbul ignore end*/
function reversePatch(structuredPatch) {
if (Array.isArray(structuredPatch)) {
return structuredPatch.map(reversePatch).reverse();
}
return (
/*istanbul ignore start*/
_objectSpread(_objectSpread({},
/*istanbul ignore end*/
structuredPatch), {}, {
oldFileName: structuredPatch.newFileName,
oldHeader: structuredPatch.newHeader,
newFileName: structuredPatch.oldFileName,
newHeader: structuredPatch.oldHeader,
hunks: structuredPatch.hunks.map(function (hunk) {
return {
oldLines: hunk.newLines,
oldStart: hunk.newStart,
newLines: hunk.oldLines,
newStart: hunk.oldStart,
linedelimiters: hunk.linedelimiters,
lines: hunk.lines.map(function (l) {
if (l.startsWith('-')) {
return (
/*istanbul ignore start*/
"+".concat(
/*istanbul ignore end*/
l.slice(1))
);
}
if (l.startsWith('+')) {
return (
/*istanbul ignore start*/
"-".concat(
/*istanbul ignore end*/
l.slice(1))
);
}
return l;
})
};
})
})
);
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9yZXZlcnNlLmpzIl0sIm5hbWVzIjpbInJldmVyc2VQYXRjaCIsInN0cnVjdHVyZWRQYXRjaCIsIkFycmF5IiwiaXNBcnJheSIsIm1hcCIs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AgICBuZXdIZWFkZXI6IHN0cnVjdHVyZWRQYXRjaC5vbGRIZWFkZXIsXG4gICAgaHVua3M6IHN0cnVjdHVyZWRQYXRjaC5odW5rcy5tYXAoaHVuayA9PiB7XG4gICAgICByZXR1cm4ge1xuICAgICAgICBvbGRMaW5lczogaHVuay5uZXdMaW5lcyxcbiAgICAgICAgb2xkU3RhcnQ6IGh1bmsubmV3U3RhcnQsXG4gICAgICAgIG5ld0xpbmVzOiBodW5rLm9sZExpbmVzLFxuICAgICAgICBuZXdTdGFydDogaHVuay5vbGRTdGFydCxcbiAgICAgICAgbGluZWRlbGltaXRlcnM6IGh1bmsubGluZWRlbGltaXRlcnMsXG4gICAgICAgIGxpbmVzOiBodW5rLmxpbmVzLm1hcChsID0+IHtcbiAgICAgICAgICBpZiAobC5zdGFydHNXaXRoKCctJykpIHsgcmV0dXJuIGArJHtsLnNsaWNlKDEpfWA7IH1cbiAgICAgICAgICBpZiAobC5zdGFydHNXaXRoKCcrJykpIHsgcmV0dXJuIGAtJHtsLnNsaWNlKDEpfWA7IH1cbiAgICAgICAgICByZXR1cm4gbDtcbiAgICAgICAgfSlcbiAgICAgIH07XG4gICAgfSlcbiAgfTtcbn1cbiJdfQ==

14
node_modules/diff/package.json generated vendored
View file

@ -1,7 +1,7 @@
{
"name": "diff",
"version": "5.1.0",
"description": "A javascript text diff implementation.",
"version": "5.2.0",
"description": "A JavaScript text diff implementation.",
"keywords": [
"diff",
"jsdiff",
@ -13,7 +13,8 @@
"javascript"
],
"maintainers": [
"Kevin Decker <kpdecker@gmail.com> (http://incaseofstairs.com)"
"Kevin Decker <kpdecker@gmail.com> (http://incaseofstairs.com)",
"Mark Amery <markrobertamery+jsdiff@gmail.com>"
],
"bugs": {
"email": "kpdecker@gmail.com",
@ -37,7 +38,8 @@
"require": "./lib/index.js"
},
"./package.json": "./package.json",
"./": "./"
"./": "./",
"./*": "./*"
},
"scripts": {
"clean": "rm -rf lib/ dist/",
@ -50,10 +52,10 @@
"@babel/plugin-transform-modules-commonjs": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@babel/register": "^7.0.0",
"@colors/colors": "^1.3.3",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"chai": "^4.2.0",
"colors": "^1.3.3",
"eslint": "^5.12.0",
"grunt": "^1.0.3",
"grunt-babel": "^8.0.0",
@ -69,7 +71,7 @@
"grunt-mocha-test": "^0.13.3",
"grunt-webpack": "^3.1.3",
"istanbul": "github:kpdecker/istanbul",
"karma": "^5.1.1",
"karma": "^6.3.16",
"karma-chrome-launcher": "^3.1.0",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.0.0",

14
node_modules/diff/release-notes.md generated vendored
View file

@ -1,14 +1,22 @@
# Release Notes
## Development
## v5.2.0
[Commits](https://github.com/kpdecker/jsdiff/compare/v5.0.0...master)
[Commits](https://github.com/kpdecker/jsdiff/compare/v5.1.0...master)
- [#411](https://github.com/kpdecker/jsdiff/pull/411) Big performance improvement. Previously an O(n) array-copying operation inside the innermost loop of jsdiff's base diffing code increased the overall worst-case time complexity of computing a diff from O(n²) to O(n³). This is now fixed, bringing the worst-case time complexity down to what it theoretically should be for a Myers diff implementation.
- [#448](https://github.com/kpdecker/jsdiff/pull/411) Performance improvement. Diagonals whose furthest-reaching D-path would go off the edge of the edit graph are now skipped, rather than being pointlessly considered as called for by the original Myers diff algorithm. This dramatically speeds up computing diffs where the new text just appends or truncates content at the end of the old text.
- [#351](https://github.com/kpdecker/jsdiff/issues/351) Importing from the lib folder - e.g. `require("diff/lib/diff/word.js")` - will work again now. This had been broken for users on the latest version of Node since Node 17.5.0, which changed how Node interprets the `exports` property in jsdiff's `package.json` file.
- [#344](https://github.com/kpdecker/jsdiff/issues/344) `diffLines`, `createTwoFilesPatch`, and other patch-creation methods now take an optional `stripTrailingCr: true` option which causes Windows-style `\r\n` line endings to be replaced with Unix-style `\n` line endings before calculating the diff, just like GNU `diff`'s `--strip-trailing-cr` flag.
- [#451](https://github.com/kpdecker/jsdiff/pull/451) Added `diff.formatPatch`.
- [#450](https://github.com/kpdecker/jsdiff/pull/450) Added `diff.reversePatch`.
- [#478](https://github.com/kpdecker/jsdiff/pull/478) Added `timeout` option.
## v5.1.0
- [#365](https://github.com/kpdecker/jsdiff/issues/365) Allow early termination to limit execution time with degenerate cases
[Commits](https://github.com/kpdecker/jsdiff/compare/v5.0.0...v5.0.1)
[Commits](https://github.com/kpdecker/jsdiff/compare/v5.0.0...v5.1.0)
## v5.0.0

54
node_modules/isarray/README.md generated vendored
View file

@ -1,54 +0,0 @@
# isarray
`Array#isArray` for older browsers.
## Usage
```js
var isArray = require('isarray');
console.log(isArray([])); // => true
console.log(isArray({})); // => false
```
## Installation
With [npm](http://npmjs.org) do
```bash
$ npm install isarray
```
Then bundle for the browser with
[browserify](https://github.com/substack/browserify).
With [component](http://component.io) do
```bash
$ component install juliangruber/isarray
```
## License
(MIT)
Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

209
node_modules/isarray/build/build.js generated vendored
View file

@ -1,209 +0,0 @@
/**
* Require the given path.
*
* @param {String} path
* @return {Object} exports
* @api public
*/
function require(path, parent, orig) {
var resolved = require.resolve(path);
// lookup failed
if (null == resolved) {
orig = orig || path;
parent = parent || 'root';
var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
err.path = orig;
err.parent = parent;
err.require = true;
throw err;
}
var module = require.modules[resolved];
// perform real require()
// by invoking the module's
// registered function
if (!module.exports) {
module.exports = {};
module.client = module.component = true;
module.call(this, module.exports, require.relative(resolved), module);
}
return module.exports;
}
/**
* Registered modules.
*/
require.modules = {};
/**
* Registered aliases.
*/
require.aliases = {};
/**
* Resolve `path`.
*
* Lookup:
*
* - PATH/index.js
* - PATH.js
* - PATH
*
* @param {String} path
* @return {String} path or null
* @api private
*/
require.resolve = function(path) {
if (path.charAt(0) === '/') path = path.slice(1);
var index = path + '/index.js';
var paths = [
path,
path + '.js',
path + '.json',
path + '/index.js',
path + '/index.json'
];
for (var i = 0; i < paths.length; i++) {
var path = paths[i];
if (require.modules.hasOwnProperty(path)) return path;
}
if (require.aliases.hasOwnProperty(index)) {
return require.aliases[index];
}
};
/**
* Normalize `path` relative to the current path.
*
* @param {String} curr
* @param {String} path
* @return {String}
* @api private
*/
require.normalize = function(curr, path) {
var segs = [];
if ('.' != path.charAt(0)) return path;
curr = curr.split('/');
path = path.split('/');
for (var i = 0; i < path.length; ++i) {
if ('..' == path[i]) {
curr.pop();
} else if ('.' != path[i] && '' != path[i]) {
segs.push(path[i]);
}
}
return curr.concat(segs).join('/');
};
/**
* Register module at `path` with callback `definition`.
*
* @param {String} path
* @param {Function} definition
* @api private
*/
require.register = function(path, definition) {
require.modules[path] = definition;
};
/**
* Alias a module definition.
*
* @param {String} from
* @param {String} to
* @api private
*/
require.alias = function(from, to) {
if (!require.modules.hasOwnProperty(from)) {
throw new Error('Failed to alias "' + from + '", it does not exist');
}
require.aliases[to] = from;
};
/**
* Return a require function relative to the `parent` path.
*
* @param {String} parent
* @return {Function}
* @api private
*/
require.relative = function(parent) {
var p = require.normalize(parent, '..');
/**
* lastIndexOf helper.
*/
function lastIndexOf(arr, obj) {
var i = arr.length;
while (i--) {
if (arr[i] === obj) return i;
}
return -1;
}
/**
* The relative require() itself.
*/
function localRequire(path) {
var resolved = localRequire.resolve(path);
return require(resolved, parent, path);
}
/**
* Resolve relative to the parent.
*/
localRequire.resolve = function(path) {
var c = path.charAt(0);
if ('/' == c) return path.slice(1);
if ('.' == c) return require.normalize(p, path);
// resolve deps by returning
// the dep in the nearest "deps"
// directory
var segs = parent.split('/');
var i = lastIndexOf(segs, 'deps') + 1;
if (!i) i = 0;
path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
return path;
};
/**
* Check if module is defined at `path`.
*/
localRequire.exists = function(path) {
return require.modules.hasOwnProperty(localRequire.resolve(path));
};
return localRequire;
};
require.register("isarray/index.js", function(exports, require, module){
module.exports = Array.isArray || function (arr) {
return Object.prototype.toString.call(arr) == '[object Array]';
};
});
require.alias("isarray/index.js", "isarray/index.js");

19
node_modules/isarray/component.json generated vendored
View file

@ -1,19 +0,0 @@
{
"name" : "isarray",
"description" : "Array#isArray for older browsers",
"version" : "0.0.1",
"repository" : "juliangruber/isarray",
"homepage": "https://github.com/juliangruber/isarray",
"main" : "index.js",
"scripts" : [
"index.js"
],
"dependencies" : {},
"keywords": ["browser","isarray","array"],
"author": {
"name": "Julian Gruber",
"email": "mail@juliangruber.com",
"url": "http://juliangruber.com"
},
"license": "MIT"
}

3
node_modules/isarray/index.js generated vendored
View file

@ -1,3 +0,0 @@
module.exports = Array.isArray || function (arr) {
return Object.prototype.toString.call(arr) == '[object Array]';
};

29
node_modules/isarray/package.json generated vendored
View file

@ -1,29 +0,0 @@
{
"name": "isarray",
"description": "Array#isArray for older browsers",
"version": "0.0.1",
"repository": {
"type": "git",
"url": "git://github.com/juliangruber/isarray.git"
},
"homepage": "https://github.com/juliangruber/isarray",
"main": "index.js",
"scripts": {
"test": "tap test/*.js"
},
"dependencies": {},
"devDependencies": {
"tap": "*"
},
"keywords": [
"browser",
"isarray",
"array"
],
"author": {
"name": "Julian Gruber",
"email": "mail@juliangruber.com",
"url": "http://juliangruber.com"
},
"license": "MIT"
}

19
node_modules/just-extend/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,19 @@
# just-extend
## 6.2.0
### Minor Changes
- Rename node module .js -> .cjs
## 6.1.1
### Patch Changes
- fix: reorder exports to set default last #488
## 6.1.0
### Minor Changes
- package.json updates to fix #467 and #483

16
node_modules/just-extend/README.md generated vendored
View file

@ -1,9 +1,21 @@
<!-- DO NOT EDIT THIS FILE! THIS FILE WAS AUTOGENERATED BY TEMPLATE-MATE -->
<!-- SEE https://github.com/angus-c/just/blob/master/CONTRIBUTING.md#readme-template -->
## just-extend
Part of a [library](../../../../) of zero-dependency npm modules that do just do one thing.
Part of a [library](https://anguscroll.com/just) of zero-dependency npm modules that do just do one thing.
Guilt-free utilities for every occasion.
[Try it now](http://anguscroll.com/just/just-extend)
[`🍦 Try it`](https://anguscroll.com/just/just-extend)
```shell
npm install just-extend
```
```shell
yarn add just-extend
```
Extend an object
```js
import extend from 'just-extend';

View file

@ -1,4 +1,4 @@
// Definitions by: Peter Safranek <https://github.com/pe8ter>
declare function extend(obj1: object, ...objn: any[]): object;
declare function extend(deep: boolean, obj1: object, ...objn: any[]): object;
export = extend;
export default extend;

74
node_modules/just-extend/index.mjs generated vendored Normal file
View file

@ -0,0 +1,74 @@
var objectExtend = extend;
/*
var obj = {a: 3, b: 5};
extend(obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
obj; // {a: 4, b: 5, c: 8}
var obj = {a: 3, b: 5};
extend({}, obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
obj; // {a: 3, b: 5}
var arr = [1, 2, 3];
var obj = {a: 3, b: 5};
extend(obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
arr.push(4);
obj; // {a: 3, b: 5, c: [1, 2, 3, 4]}
var arr = [1, 2, 3];
var obj = {a: 3, b: 5};
extend(true, obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
arr.push(4);
obj; // {a: 3, b: 5, c: [1, 2, 3]}
extend({a: 4, b: 5}); // {a: 4, b: 5}
extend({a: 4, b: 5}, 3); {a: 4, b: 5}
extend({a: 4, b: 5}, true); {a: 4, b: 5}
extend('hello', {a: 4, b: 5}); // throws
extend(3, {a: 4, b: 5}); // throws
*/
function extend(/* [deep], obj1, obj2, [objn] */) {
var args = [].slice.call(arguments);
var deep = false;
if (typeof args[0] == 'boolean') {
deep = args.shift();
}
var result = args[0];
if (isUnextendable(result)) {
throw new Error('extendee must be an object');
}
var extenders = args.slice(1);
var len = extenders.length;
for (var i = 0; i < len; i++) {
var extender = extenders[i];
for (var key in extender) {
if (Object.prototype.hasOwnProperty.call(extender, key)) {
var value = extender[key];
if (deep && isCloneable(value)) {
var base = Array.isArray(value) ? [] : {};
result[key] = extend(
true,
Object.prototype.hasOwnProperty.call(result, key) && !isUnextendable(result[key])
? result[key]
: base,
value
);
} else {
result[key] = value;
}
}
}
}
return result;
}
function isCloneable(obj) {
return Array.isArray(obj) || {}.toString.call(obj) == '[object Object]';
}
function isUnextendable(val) {
return !val || (typeof val != 'object' && typeof val != 'function');
}
export {objectExtend as default};

View file

@ -1,42 +1,42 @@
import extend = require("./index");
import extend from './index'
// OK
// Pass single `object`.
extend({});
extend([]);
extend(() => {});
extend({});
extend([]);
extend(() => {});
// Pass single `object`, then `any`.
extend({}, 0);
extend({}, "");
extend({}, false);
extend({}, null);
extend({}, undefined);
extend({}, {});
extend({}, []);
extend({}, () => {});
extend({}, 0);
extend({}, "");
extend({}, false);
extend({}, null);
extend({}, undefined);
extend({}, {});
extend({}, []);
extend({}, () => {});
// Pass variadic args.
extend({}, 0, "", false, null, undefined, {}, [], () => {});
extend({}, 0, "", false, null, undefined, {}, [], () => {});
// Pass `boolean`, then single `object`.
extend(true, {});
extend(true, []);
extend(true, () => {});
extend(true, {});
extend(true, []);
extend(true, () => {});
// Pass `boolean`, single `object`, then `any`.
extend(true, {}, 0);
extend(true, {}, "");
extend(true, {}, false);
extend(true, {}, null);
extend(true, {}, undefined);
extend(true, {}, {});
extend(true, {}, []);
extend(true, {}, () => {});
extend(true, {}, 0);
extend(true, {}, "");
extend(true, {}, false);
extend(true, {}, null);
extend(true, {}, undefined);
extend(true, {}, {});
extend(true, {}, []);
extend(true, {}, () => {});
// Pass `boolean`, then variadic args.
extend(true, {}, 0, "", false, null, undefined, {}, [], () => {});
extend(true, {}, 0, "", false, null, undefined, {}, [], () => {});
// Not OK

View file

@ -1,11 +1,21 @@
{
"name": "just-extend",
"version": "4.2.1",
"version": "6.2.0",
"description": "extend an object",
"main": "index.js",
"type": "module",
"exports": {
".": {
"types": "./index.d.ts",
"require": "./index.cjs",
"import": "./index.mjs"
},
"./package.json": "./package.json"
},
"main": "index.cjs",
"types": "index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup -c"
},
"repository": "https://github.com/angus-c/just",
"keywords": [

3
node_modules/just-extend/rollup.config.js generated vendored Normal file
View file

@ -0,0 +1,3 @@
const createRollupConfig = require('../../config/createRollupConfig');
module.exports = createRollupConfig(__dirname);

View file

@ -11,7 +11,7 @@ function configureLogger(config) {
// Function which prints errors.
if (!config.hasOwnProperty("logger")) {
// eslint-disable-next-line no-empty-function
config.logger = function() {};
config.logger = function () {};
}
// When set to true, any errors logged will be thrown immediately;
// If set to false, the errors will be thrown in separate execution frame.
@ -28,7 +28,7 @@ function configureLogger(config) {
var err = {
name: e.name || label,
message: e.message || e.toString(),
stack: e.stack
stack: e.stack,
};
function throwLoggedError() {

View file

@ -5,22 +5,22 @@ function flattenOptions(options) {
return {
capture: Boolean(options),
once: false,
passive: false
passive: false,
};
}
return {
capture: Boolean(options.capture),
once: Boolean(options.once),
passive: Boolean(options.passive)
passive: Boolean(options.passive),
};
}
function not(fn) {
return function() {
return function () {
return !fn.apply(this, arguments);
};
}
function hasListenerFilter(listener, capture) {
return function(listenerSpec) {
return function (listenerSpec) {
return (
listenerSpec.capture === capture &&
listenerSpec.listener === listener
@ -33,7 +33,7 @@ var EventTarget = {
addEventListener: function addEventListener(
event,
listener,
providedOptions
providedOptions,
) {
// 3. Let capture, passive, and once be the result of flattening more options.
// Flatten property before executing step 2,
@ -59,13 +59,13 @@ var EventTarget = {
// callback, capture is capture, passive is passive, and once is once.
if (
!this.eventListeners[event].some(
hasListenerFilter(listener, options.capture)
hasListenerFilter(listener, options.capture),
)
) {
this.eventListeners[event].push({
listener: listener,
capture: options.capture,
once: options.once
once: options.once,
});
}
},
@ -74,7 +74,7 @@ var EventTarget = {
removeEventListener: function removeEventListener(
event,
listener,
providedOptions
providedOptions,
) {
if (!this.eventListeners || !this.eventListeners[event]) {
return;
@ -88,7 +88,7 @@ var EventTarget = {
// and capture is capture, then set that event listeners
// removed to true and remove it from the associated list of event listeners.
this.eventListeners[event] = this.eventListeners[event].filter(
not(hasListenerFilter(listener, options.capture))
not(hasListenerFilter(listener, options.capture)),
);
},
@ -103,10 +103,10 @@ var EventTarget = {
// Remove listeners, that should be dispatched once
// before running dispatch loop to avoid nested dispatch issues
self.eventListeners[type] = listeners.filter(function(listenerSpec) {
self.eventListeners[type] = listeners.filter(function (listenerSpec) {
return !listenerSpec.once;
});
listeners.forEach(function(listenerSpec) {
listeners.forEach(function (listenerSpec) {
var listener = listenerSpec.listener;
if (typeof listener === "function") {
listener.call(self, event);
@ -116,7 +116,7 @@ var EventTarget = {
});
return Boolean(event.defaultPrevented);
}
},
};
module.exports = EventTarget;

View file

@ -5,7 +5,7 @@ function Event(type, bubbles, cancelable, target) {
}
Event.prototype = {
initEvent: function(type, bubbles, cancelable, target) {
initEvent: function (type, bubbles, cancelable, target) {
this.type = type;
this.bubbles = bubbles;
this.cancelable = cancelable;
@ -14,11 +14,11 @@ Event.prototype = {
},
// eslint-disable-next-line no-empty-function
stopPropagation: function() {},
stopPropagation: function () {},
preventDefault: function() {
preventDefault: function () {
this.defaultPrevented = true;
}
},
};
module.exports = Event;

View file

@ -4,5 +4,5 @@ module.exports = {
Event: require("./event"),
ProgressEvent: require("./progress-event"),
CustomEvent: require("./custom-event"),
EventTarget: require("./event-target")
EventTarget: require("./event-target"),
};

View file

@ -23,19 +23,19 @@ fakeServerWithClock.addRequest = function addRequest(xhr) {
var clockSetInterval = this.clock.setInterval;
var server = this;
this.clock.setTimeout = function(fn, timeout) {
this.clock.setTimeout = function (fn, timeout) {
server.longestTimeout = Math.max(
timeout,
server.longestTimeout || 0
server.longestTimeout || 0,
);
return clockSetTimeout.apply(this, arguments);
};
this.clock.setInterval = function(fn, timeout) {
this.clock.setInterval = function (fn, timeout) {
server.longestTimeout = Math.max(
timeout,
server.longestTimeout || 0
server.longestTimeout || 0,
);
return clockSetInterval.apply(this, arguments);

View file

@ -4,7 +4,7 @@ var fakeXhr = require("../fake-xhr");
var push = [].push;
var log = require("./log");
var configureLogError = require("../configure-logger");
var pathToRegexp = require("path-to-regexp");
var pathToRegexp = require("path-to-regexp").pathToRegexp;
var supportsArrayBuffer = typeof ArrayBuffer !== "undefined";
@ -18,11 +18,11 @@ function responseArray(handler) {
if (typeof response[2] !== "string") {
if (!supportsArrayBuffer) {
throw new TypeError(
`Fake server response body should be a string, but was ${typeof response[2]}`
`Fake server response body should be a string, but was ${typeof response[2]}`,
);
} else if (!(response[2] instanceof ArrayBuffer)) {
throw new TypeError(
`Fake server response body should be a string or ArrayBuffer, but was ${typeof response[2]}`
`Fake server response body should be a string or ArrayBuffer, but was ${typeof response[2]}`,
);
}
}
@ -34,7 +34,7 @@ function getDefaultWindowLocation() {
var winloc = {
hostname: "localhost",
port: process.env.PORT || 80,
protocol: "http:"
protocol: "http:",
};
winloc.host =
winloc.hostname +
@ -94,7 +94,7 @@ function match(response, request) {
var args = [request].concat(
ru && typeof ru.exec === "function"
? ru.exec(requestUrl).slice(1)
: []
: [],
);
return response.response.apply(response, args);
}
@ -122,7 +122,7 @@ function incrementRequestCount() {
}
var fakeServer = {
create: function(config) {
create: function (config) {
var server = Object.create(this);
server.configure(config);
this.xhr = fakeXhr.useFakeXMLHttpRequest();
@ -131,8 +131,8 @@ var fakeServer = {
server.queue = [];
server.responses = [];
this.xhr.onCreate = function(xhrObj) {
xhrObj.unsafeHeadersEnabled = function() {
this.xhr.onCreate = function (xhrObj) {
xhrObj.unsafeHeadersEnabled = function () {
return !(server.unsafeHeadersEnabled === false);
};
server.addRequest(xhrObj);
@ -141,7 +141,7 @@ var fakeServer = {
return server;
},
configure: function(config) {
configure: function (config) {
var self = this;
var allowlist = {
autoRespond: true,
@ -149,13 +149,14 @@ var fakeServer = {
respondImmediately: true,
fakeHTTPMethods: true,
logger: true,
unsafeHeadersEnabled: true
unsafeHeadersEnabled: true,
legacyRoutes: true,
};
// eslint-disable-next-line no-param-reassign
config = config || {};
Object.keys(config).forEach(function(setting) {
Object.keys(config).forEach(function (setting) {
if (setting in allowlist) {
self[setting] = config[setting];
}
@ -170,13 +171,13 @@ var fakeServer = {
incrementRequestCount.call(this);
xhrObj.onSend = function() {
xhrObj.onSend = function () {
server.handleRequest(this);
if (server.respondImmediately) {
server.respond();
} else if (server.autoRespond && !server.responding) {
setTimeout(function() {
setTimeout(function () {
server.responding = false;
server.respond();
}, server.autoRespondAfter || 10);
@ -189,7 +190,7 @@ var fakeServer = {
getHTTPMethod: function getHTTPMethod(request) {
if (this.fakeHTTPMethods && /post/i.test(request.method)) {
var matches = (request.requestBody || "").match(
/_method=([^\b;]+)/
/_method=([^\b;]+)/,
);
return matches ? matches[1] : request.method;
}
@ -205,7 +206,7 @@ var fakeServer = {
}
},
logger: function() {
logger: function () {
// no-op; override via configure()
},
@ -213,6 +214,8 @@ var fakeServer = {
log: log,
legacyRoutes: true,
respondWith: function respondWith(method, url, body) {
if (arguments.length === 1 && typeof method !== "function") {
this.response = responseArray(method);
@ -236,17 +239,34 @@ var fakeServer = {
}
// Escape port number to prevent "named" parameters in 'path-to-regexp' module
if (typeof url === "string" && url !== "" && /:[0-9]+\//.test(url)) {
var m = url.match(/^(https?:\/\/.*?):([0-9]+\/.*)$/);
// eslint-disable-next-line no-param-reassign
url = `${m[1]}\\:${m[2]}`;
if (typeof url === "string" && url !== "") {
if (/:[0-9]+\//.test(url)) {
var m = url.match(/^(https?:\/\/.*?):([0-9]+\/.*)$/);
// eslint-disable-next-line no-param-reassign
url = `${m[1]}\\:${m[2]}`;
}
if (/:\/\//.test(url)) {
// eslint-disable-next-line no-param-reassign
url = url.replace("://", "\\://");
}
if (/\*/.test(url)) {
// eslint-disable-next-line no-param-reassign
url = url.replace(/\/\*/g, "/(.*)");
}
if (this.legacyRoutes) {
if (url.includes("?")) {
// eslint-disable-next-line no-param-reassign
url = url.replace("?", "\\?");
}
}
}
push.call(this.responses, {
method: method,
url:
typeof url === "string" && url !== "" ? pathToRegexp(url) : url,
response: typeof body === "function" ? body : responseArray(body)
response: typeof body === "function" ? body : responseArray(body),
});
},
@ -259,7 +279,7 @@ var fakeServer = {
var requests = queue.splice(0, queue.length);
var self = this;
requests.forEach(function(request) {
requests.forEach(function (request) {
self.processRequest(request);
});
},
@ -324,10 +344,18 @@ var fakeServer = {
resetHistory: function resetHistory() {
this.requests.length = this.requestCount = 0;
this.requestedOnce = this.requestedTwice = this.requestedThrice = this.requested = false;
this.requestedOnce =
this.requestedTwice =
this.requestedThrice =
this.requested =
false;
this.firstRequest = this.secondRequest = this.thirdRequest = this.lastRequest = null;
}
this.firstRequest =
this.secondRequest =
this.thirdRequest =
this.lastRequest =
null;
},
};
module.exports = fakeServer;

View file

@ -1,6 +1,6 @@
"use strict";
exports.isSupported = (function() {
exports.isSupported = (function () {
try {
return Boolean(new Blob());
} catch (e) {

View file

@ -23,7 +23,7 @@ function getWorkingXHR(globalScope) {
var supportsActiveX = typeof globalScope.ActiveXObject !== "undefined";
if (supportsActiveX) {
return function() {
return function () {
return new globalScope.ActiveXObject("MSXML2.XMLHTTP.3.0");
};
}
@ -54,7 +54,7 @@ var unsafeHeaders = {
"Transfer-Encoding": true,
Upgrade: true,
"User-Agent": true,
Via: true
Via: true,
};
function EventTargetHandler() {
@ -66,11 +66,11 @@ function EventTargetHandler() {
"error",
"load",
"timeout",
"loadend"
"loadend",
];
function addEventListener(eventName) {
self.addEventListener(eventName, function(event) {
self.addEventListener(eventName, function (event) {
var listener = self[`on${eventName}`];
if (listener && typeof listener === "function") {
@ -91,7 +91,7 @@ function normalizeHeaderValue(value) {
}
function getHeader(headers, header) {
var foundHeader = Object.keys(headers).filter(function(h) {
var foundHeader = Object.keys(headers).filter(function (h) {
return h.toLowerCase() === header.toLowerCase();
});
@ -109,7 +109,7 @@ function verifyResponseBodyType(body, responseType) {
if (responseType === "arraybuffer") {
if (!isString && !(body instanceof ArrayBuffer)) {
error = new Error(
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string or ArrayBuffer.`
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string or ArrayBuffer.`,
);
error.name = "InvalidBodyException";
}
@ -121,13 +121,13 @@ function verifyResponseBodyType(body, responseType) {
!(body instanceof Blob)
) {
error = new Error(
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string, ArrayBuffer, or Blob.`
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string, ArrayBuffer, or Blob.`,
);
error.name = "InvalidBodyException";
}
} else if (!isString) {
error = new Error(
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string.`
`Attempted to respond to fake XMLHttpRequest with ${body}, which is not a string.`,
);
error.name = "InvalidBodyException";
}
@ -220,7 +220,7 @@ function fakeXMLHttpRequestFor(globalScope) {
}
// largest arity in XHR is 5 - XHR#open
var apply = function(obj, method, args) {
var apply = function (obj, method, args) {
switch (args.length) {
case 0:
return obj[method]();
@ -254,14 +254,14 @@ function fakeXMLHttpRequestFor(globalScope) {
"getAllResponseHeaders",
"addEventListener",
"overrideMimeType",
"removeEventListener"
].forEach(function(method) {
fakeXhr[method] = function() {
"removeEventListener",
].forEach(function (method) {
fakeXhr[method] = function () {
return apply(xhr, method, arguments);
};
});
fakeXhr.send = function() {
fakeXhr.send = function () {
// Ref: https://xhr.spec.whatwg.org/#the-responsetype-attribute
if (xhr.responseType !== fakeXhr.responseType) {
xhr.responseType = fakeXhr.responseType;
@ -269,13 +269,13 @@ function fakeXMLHttpRequestFor(globalScope) {
return apply(xhr, "send", arguments);
};
var copyAttrs = function(args) {
args.forEach(function(attr) {
var copyAttrs = function (args) {
args.forEach(function (attr) {
fakeXhr[attr] = xhr[attr];
});
};
var stateChangeStart = function() {
var stateChangeStart = function () {
fakeXhr.readyState = xhr.readyState;
if (xhr.readyState >= FakeXMLHttpRequest.HEADERS_RECEIVED) {
copyAttrs(["status", "statusText"]);
@ -294,12 +294,12 @@ function fakeXMLHttpRequestFor(globalScope) {
}
};
var stateChangeEnd = function() {
var stateChangeEnd = function () {
if (fakeXhr.onreadystatechange) {
// eslint-disable-next-line no-useless-call
fakeXhr.onreadystatechange.call(fakeXhr, {
target: fakeXhr,
currentTarget: fakeXhr
currentTarget: fakeXhr,
});
}
};
@ -312,12 +312,12 @@ function fakeXMLHttpRequestFor(globalScope) {
if (xhr.addEventListener) {
xhr.addEventListener("readystatechange", stateChangeStart);
Object.keys(fakeXhr.eventListeners).forEach(function(event) {
Object.keys(fakeXhr.eventListeners).forEach(function (event) {
/*eslint-disable no-loop-func*/
fakeXhr.eventListeners[event].forEach(function(handler) {
fakeXhr.eventListeners[event].forEach(function (handler) {
xhr.addEventListener(event, handler.listener, {
capture: handler.capture,
once: handler.once
once: handler.once,
});
});
/*eslint-enable no-loop-func*/
@ -436,7 +436,7 @@ function fakeXMLHttpRequestFor(globalScope) {
return result.getElementsByTagNameNS(
parsererrorNS,
"parsererror"
"parsererror",
).length
? null
: result;
@ -495,7 +495,7 @@ function fakeXMLHttpRequestFor(globalScope) {
502: "Bad Gateway",
503: "Service Unavailable",
504: "Gateway Timeout",
505: "HTTP Version Not Supported"
505: "HTTP Version Not Supported",
};
extend(FakeXMLHttpRequest.prototype, sinonEvent.EventTarget, {
@ -513,7 +513,7 @@ function fakeXMLHttpRequestFor(globalScope) {
if (FakeXMLHttpRequest.useFilters === true) {
var xhrArgs = arguments;
var defake = FakeXMLHttpRequest.filters.some(function(filter) {
var defake = FakeXMLHttpRequest.filters.some(function (filter) {
return filter.apply(this, xhrArgs);
});
if (defake) {
@ -531,7 +531,7 @@ function fakeXMLHttpRequestFor(globalScope) {
"readystatechange",
false,
false,
this
this,
);
if (typeof this.onreadystatechange === "function") {
try {
@ -559,25 +559,29 @@ function fakeXMLHttpRequestFor(globalScope) {
if (supportsProgress) {
this.upload.dispatchEvent(
new sinonEvent.ProgressEvent("progress", progress, this)
new sinonEvent.ProgressEvent(
"progress",
progress,
this,
),
);
this.upload.dispatchEvent(
new sinonEvent.ProgressEvent(event, progress, this)
new sinonEvent.ProgressEvent(event, progress, this),
);
this.upload.dispatchEvent(
new sinonEvent.ProgressEvent("loadend", progress, this)
new sinonEvent.ProgressEvent("loadend", progress, this),
);
}
this.dispatchEvent(
new sinonEvent.ProgressEvent("progress", progress, this)
new sinonEvent.ProgressEvent("progress", progress, this),
);
this.dispatchEvent(
new sinonEvent.ProgressEvent(event, progress, this)
new sinonEvent.ProgressEvent(event, progress, this),
);
this.dispatchEvent(readyStateChangeEvent);
this.dispatchEvent(
new sinonEvent.ProgressEvent("loadend", progress, this)
new sinonEvent.ProgressEvent("loadend", progress, this),
);
}
},
@ -586,7 +590,7 @@ function fakeXMLHttpRequestFor(globalScope) {
setRequestHeader: function setRequestHeader(header, value) {
if (typeof value !== "string") {
throw new TypeError(
`By RFC7230, section 3.2.4, header values should be strings. Got ${typeof value}`
`By RFC7230, section 3.2.4, header values should be strings. Got ${typeof value}`,
);
}
verifyState(this);
@ -603,7 +607,7 @@ function fakeXMLHttpRequestFor(globalScope) {
) {
throw new Error(
// eslint-disable-next-line quotes
`Refused to set unsafe header "${header}"`
`Refused to set unsafe header "${header}"`,
);
}
@ -632,7 +636,7 @@ function fakeXMLHttpRequestFor(globalScope) {
var responseHeaders = (this.responseHeaders = {});
Object.keys(headers).forEach(function(header) {
Object.keys(headers).forEach(function (header) {
responseHeaders[header] = headers[header];
});
@ -650,13 +654,12 @@ function fakeXMLHttpRequestFor(globalScope) {
if (!/^(head)$/i.test(this.method)) {
var contentType = getHeader(
this.requestHeaders,
"Content-Type"
"Content-Type",
);
if (this.requestHeaders[contentType]) {
var value = this.requestHeaders[contentType].split(";");
this.requestHeaders[
contentType
] = `${value[0]};charset=utf-8`;
this.requestHeaders[contentType] =
`${value[0]};charset=utf-8`;
} else if (supportsFormData && !(data instanceof FormData)) {
this.requestHeaders["Content-Type"] =
"text/plain;charset=utf-8";
@ -687,7 +690,7 @@ function fakeXMLHttpRequestFor(globalScope) {
// is in flight, so we must check anytime the end user forces a clock tick to make
// sure timeout hasn't changed.
// https://xhr.spec.whatwg.org/#dfnReturnLink-2
var clearIntervalId = setInterval(function() {
var clearIntervalId = setInterval(function () {
// Check if the readyState has been reset or is done. If this is the case, there
// should be no timeout. This will also prevent aborted requests and
// fakeServerWithClock from triggering unnecessary responses.
@ -709,7 +712,7 @@ function fakeXMLHttpRequestFor(globalScope) {
}
this.dispatchEvent(
new sinonEvent.Event("loadstart", false, false, this)
new sinonEvent.Event("loadstart", false, false, this),
);
},
@ -719,7 +722,7 @@ function fakeXMLHttpRequestFor(globalScope) {
this.readyState = FakeXMLHttpRequest.UNSENT;
},
error: function() {
error: function () {
clearResponse(this);
this.errorFlag = true;
this.requestHeaders = {};
@ -758,7 +761,7 @@ function fakeXMLHttpRequestFor(globalScope) {
var responseHeaders = this.responseHeaders;
var headers = Object.keys(responseHeaders)
.filter(excludeSetCookie2Header)
.reduce(function(prev, header) {
.reduce(function (prev, header) {
var value = responseHeaders[header];
return `${prev}${header}: ${value}\r\n`;
@ -788,7 +791,7 @@ function fakeXMLHttpRequestFor(globalScope) {
if (isTextResponse) {
this.responseText = this.response += body.substring(
index,
index + chunkSize
index + chunkSize,
);
}
index += chunkSize;
@ -798,7 +801,7 @@ function fakeXMLHttpRequestFor(globalScope) {
this.response = convertResponseBody(
this.responseType,
contentType,
body
body,
);
if (isTextResponse) {
this.responseText = this.response;
@ -811,7 +814,7 @@ function fakeXMLHttpRequestFor(globalScope) {
isXmlContentType(contentType)
) {
this.responseXML = FakeXMLHttpRequest.parseXML(
this.responseText
this.responseText,
);
}
this.readyStateChange(FakeXMLHttpRequest.DONE);
@ -831,8 +834,8 @@ function fakeXMLHttpRequestFor(globalScope) {
new sinonEvent.ProgressEvent(
"progress",
progressEventRaw,
this.upload
)
this.upload,
),
);
}
},
@ -843,8 +846,8 @@ function fakeXMLHttpRequestFor(globalScope) {
new sinonEvent.ProgressEvent(
"progress",
progressEventRaw,
this
)
this,
),
);
}
},
@ -852,7 +855,7 @@ function fakeXMLHttpRequestFor(globalScope) {
uploadError: function uploadError(error) {
if (supportsCustomEvent) {
this.upload.dispatchEvent(
new sinonEvent.CustomEvent("error", { detail: error })
new sinonEvent.CustomEvent("error", { detail: error }),
);
}
},
@ -862,7 +865,7 @@ function fakeXMLHttpRequestFor(globalScope) {
throw new Error("INVALID_STATE_ERR");
}
this.overriddenMimeType = type;
}
},
});
var states = {
@ -870,7 +873,7 @@ function fakeXMLHttpRequestFor(globalScope) {
OPENED: 1,
HEADERS_RECEIVED: 2,
LOADING: 3,
DONE: 4
DONE: 4,
};
extend(FakeXMLHttpRequest, states);
@ -915,10 +918,10 @@ function fakeXMLHttpRequestFor(globalScope) {
return {
xhr: sinonXhr,
FakeXMLHttpRequest: FakeXMLHttpRequest,
useFakeXMLHttpRequest: useFakeXMLHttpRequest
useFakeXMLHttpRequest: useFakeXMLHttpRequest,
};
}
module.exports = extend(fakeXMLHttpRequestFor(globalObject), {
fakeXMLHttpRequestFor: fakeXMLHttpRequestFor
fakeXMLHttpRequestFor: fakeXMLHttpRequestFor,
});

2
node_modules/nise/lib/index.js generated vendored
View file

@ -3,5 +3,5 @@
module.exports = {
fakeServer: require("./fake-server"),
fakeServerWithClock: require("./fake-server/fake-server-with-clock"),
fakeXhr: require("./fake-xhr")
fakeXhr: require("./fake-xhr"),
};

2505
node_modules/nise/nise.js generated vendored

File diff suppressed because it is too large Load diff

View file

@ -1,29 +0,0 @@
BSD 3-Clause License
Copyright (c) 2018, Sinon.JS
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -1,16 +0,0 @@
# commons
[![CircleCI](https://circleci.com/gh/sinonjs/commons.svg?style=svg)](https://circleci.com/gh/sinonjs/commons)
[![codecov](https://codecov.io/gh/sinonjs/commons/branch/master/graph/badge.svg)](https://codecov.io/gh/sinonjs/commons)
<a href="CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
Simple functions shared among the sinon end user libraries
## Rules
- Follows the [Sinon.JS compatibility](https://github.com/sinonjs/sinon/blob/master/CONTRIBUTING.md#compatibility)
- 100% test coverage
- Code formatted using [Prettier](https://prettier.io)
- No side effects welcome! (only pure functions)
- No platform specific functions
- One export per file (any bundler can do tree shaking)

View file

@ -1,57 +0,0 @@
"use strict";
var every = require("./prototypes/array").every;
/**
* @private
*/
function hasCallsLeft(callMap, spy) {
if (callMap[spy.id] === undefined) {
callMap[spy.id] = 0;
}
return callMap[spy.id] < spy.callCount;
}
/**
* @private
*/
function checkAdjacentCalls(callMap, spy, index, spies) {
var calledBeforeNext = true;
if (index !== spies.length - 1) {
calledBeforeNext = spy.calledBefore(spies[index + 1]);
}
if (hasCallsLeft(callMap, spy) && calledBeforeNext) {
callMap[spy.id] += 1;
return true;
}
return false;
}
/**
* A Sinon proxy object (fake, spy, stub)
*
* @typedef {object} SinonProxy
* @property {Function} calledBefore - A method that determines if this proxy was called before another one
* @property {string} id - Some id
* @property {number} callCount - Number of times this proxy has been called
*/
/**
* Returns true when the spies have been called in the order they were supplied in
*
* @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments
* @returns {boolean} true when spies are called in order, false otherwise
*/
function calledInOrder(spies) {
var callMap = {};
// eslint-disable-next-line no-underscore-dangle
var _spies = arguments.length > 1 ? arguments : spies;
return every(_spies, checkAdjacentCalls.bind(null, callMap));
}
module.exports = calledInOrder;

View file

@ -1,121 +0,0 @@
"use strict";
var assert = require("@sinonjs/referee-sinon").assert;
var calledInOrder = require("./called-in-order");
var sinon = require("@sinonjs/referee-sinon").sinon;
var testObject1 = {
someFunction: function () {
return;
},
};
var testObject2 = {
otherFunction: function () {
return;
},
};
var testObject3 = {
thirdFunction: function () {
return;
},
};
function testMethod() {
testObject1.someFunction();
testObject2.otherFunction();
testObject2.otherFunction();
testObject2.otherFunction();
testObject3.thirdFunction();
}
describe("calledInOrder", function () {
beforeEach(function () {
sinon.stub(testObject1, "someFunction");
sinon.stub(testObject2, "otherFunction");
sinon.stub(testObject3, "thirdFunction");
testMethod();
});
afterEach(function () {
testObject1.someFunction.restore();
testObject2.otherFunction.restore();
testObject3.thirdFunction.restore();
});
describe("given single array argument", function () {
describe("when stubs were called in expected order", function () {
it("returns true", function () {
assert.isTrue(
calledInOrder([
testObject1.someFunction,
testObject2.otherFunction,
])
);
assert.isTrue(
calledInOrder([
testObject1.someFunction,
testObject2.otherFunction,
testObject2.otherFunction,
testObject3.thirdFunction,
])
);
});
});
describe("when stubs were called in unexpected order", function () {
it("returns false", function () {
assert.isFalse(
calledInOrder([
testObject2.otherFunction,
testObject1.someFunction,
])
);
assert.isFalse(
calledInOrder([
testObject2.otherFunction,
testObject1.someFunction,
testObject1.someFunction,
testObject3.thirdFunction,
])
);
});
});
});
describe("given multiple arguments", function () {
describe("when stubs were called in expected order", function () {
it("returns true", function () {
assert.isTrue(
calledInOrder(
testObject1.someFunction,
testObject2.otherFunction
)
);
assert.isTrue(
calledInOrder(
testObject1.someFunction,
testObject2.otherFunction,
testObject3.thirdFunction
)
);
});
});
describe("when stubs were called in unexpected order", function () {
it("returns false", function () {
assert.isFalse(
calledInOrder(
testObject2.otherFunction,
testObject1.someFunction
)
);
assert.isFalse(
calledInOrder(
testObject2.otherFunction,
testObject1.someFunction,
testObject3.thirdFunction
)
);
});
});
});
});

View file

@ -1,27 +0,0 @@
"use strict";
var functionName = require("./function-name");
/**
* Returns a display name for a value from a constructor
*
* @param {object} value A value to examine
* @returns {(string|null)} A string or null
*/
function className(value) {
return (
(value.constructor && value.constructor.name) ||
// The next branch is for IE11 support only:
// Because the name property is not set on the prototype
// of the Function object, we finally try to grab the
// name from its definition. This will never be reached
// in node, so we are not able to test this properly.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
(typeof value.constructor === "function" &&
/* istanbul ignore next */
functionName(value.constructor)) ||
null
);
}
module.exports = className;

View file

@ -1,37 +0,0 @@
"use strict";
/* eslint-disable no-empty-function */
var assert = require("@sinonjs/referee").assert;
var className = require("./class-name");
describe("className", function () {
it("returns the class name of an instance", function () {
// Because eslint-config-sinon disables es6, we can't
// use a class definition here
// https://github.com/sinonjs/eslint-config-sinon/blob/master/index.js
// var instance = new (class TestClass {})();
var instance = new (function TestClass() {})();
var name = className(instance);
assert.equals(name, "TestClass");
});
it("returns 'Object' for {}", function () {
var name = className({});
assert.equals(name, "Object");
});
it("returns null for an object that has no prototype", function () {
var obj = Object.create(null);
var name = className(obj);
assert.equals(name, null);
});
it("returns null for an object whose prototype was mangled", function () {
// This is what Node v6 and v7 do for objects returned by querystring.parse()
function MangledObject() {}
MangledObject.prototype = Object.create(null);
var obj = new MangledObject();
var name = className(obj);
assert.equals(name, null);
});
});

View file

@ -1,51 +0,0 @@
/* eslint-disable no-console */
"use strict";
/**
* Returns a function that will invoke the supplied function and print a
* deprecation warning to the console each time it is called.
*
* @param {Function} func
* @param {string} msg
* @returns {Function}
*/
exports.wrap = function (func, msg) {
var wrapped = function () {
exports.printWarning(msg);
return func.apply(this, arguments);
};
if (func.prototype) {
wrapped.prototype = func.prototype;
}
return wrapped;
};
/**
* Returns a string which can be supplied to `wrap()` to notify the user that a
* particular part of the sinon API has been deprecated.
*
* @param {string} packageName
* @param {string} funcName
* @returns {string}
*/
exports.defaultMsg = function (packageName, funcName) {
return `${packageName}.${funcName} is deprecated and will be removed from the public API in a future version of ${packageName}.`;
};
/**
* Prints a warning on the console, when it exists
*
* @param {string} msg
* @returns {undefined}
*/
exports.printWarning = function (msg) {
/* istanbul ignore next */
if (typeof process === "object" && process.emitWarning) {
// Emit Warnings in Node
process.emitWarning(msg);
} else if (console.info) {
console.info(msg);
} else {
console.log(msg);
}
};

View file

@ -1,101 +0,0 @@
/* eslint-disable no-console */
"use strict";
var assert = require("@sinonjs/referee-sinon").assert;
var sinon = require("@sinonjs/referee-sinon").sinon;
var deprecated = require("./deprecated");
var msg = "test";
describe("deprecated", function () {
describe("defaultMsg", function () {
it("should return a string", function () {
assert.equals(
deprecated.defaultMsg("sinon", "someFunc"),
"sinon.someFunc is deprecated and will be removed from the public API in a future version of sinon."
);
});
});
describe("printWarning", function () {
beforeEach(function () {
sinon.replace(process, "emitWarning", sinon.fake());
});
afterEach(sinon.restore);
describe("when `process.emitWarning` is defined", function () {
it("should call process.emitWarning with a msg", function () {
deprecated.printWarning(msg);
assert.calledOnceWith(process.emitWarning, msg);
});
});
describe("when `process.emitWarning` is undefined", function () {
beforeEach(function () {
sinon.replace(console, "info", sinon.fake());
sinon.replace(console, "log", sinon.fake());
process.emitWarning = undefined;
});
afterEach(sinon.restore);
describe("when `console.info` is defined", function () {
it("should call `console.info` with a message", function () {
deprecated.printWarning(msg);
assert.calledOnceWith(console.info, msg);
});
});
describe("when `console.info` is undefined", function () {
it("should call `console.log` with a message", function () {
console.info = undefined;
deprecated.printWarning(msg);
assert.calledOnceWith(console.log, msg);
});
});
});
});
describe("wrap", function () {
// eslint-disable-next-line mocha/no-setup-in-describe
var method = sinon.fake();
var wrapped;
beforeEach(function () {
wrapped = deprecated.wrap(method, msg);
});
it("should return a wrapper function", function () {
assert.match(wrapped, sinon.match.func);
});
it("should assign the prototype of the passed method", function () {
assert.equals(method.prototype, wrapped.prototype);
});
context("when the passed method has falsy prototype", function () {
it("should not be assigned to the wrapped method", function () {
method.prototype = null;
wrapped = deprecated.wrap(method, msg);
assert.match(wrapped.prototype, sinon.match.object);
});
});
context("when invoking the wrapped function", function () {
before(function () {
sinon.replace(deprecated, "printWarning", sinon.fake());
wrapped({});
});
it("should call `printWarning` before invoking", function () {
assert.calledOnceWith(deprecated.printWarning, msg);
});
it("should invoke the passed method with the given arguments", function () {
assert.calledOnceWith(method, {});
});
});
});
});

View file

@ -1,27 +0,0 @@
"use strict";
/**
* Returns true when fn returns true for all members of obj.
* This is an every implementation that works for all iterables
*
* @param {object} obj
* @param {Function} fn
* @returns {boolean}
*/
module.exports = function every(obj, fn) {
var pass = true;
try {
// eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
obj.forEach(function () {
if (!fn.apply(this, arguments)) {
// Throwing an error is the only way to break `forEach`
throw new Error();
}
});
} catch (e) {
pass = false;
}
return pass;
};

View file

@ -1,41 +0,0 @@
"use strict";
var assert = require("@sinonjs/referee-sinon").assert;
var sinon = require("@sinonjs/referee-sinon").sinon;
var every = require("./every");
describe("util/core/every", function () {
it("returns true when the callback function returns true for every element in an iterable", function () {
var obj = [true, true, true, true];
var allTrue = every(obj, function (val) {
return val;
});
assert(allTrue);
});
it("returns false when the callback function returns false for any element in an iterable", function () {
var obj = [true, true, true, false];
var result = every(obj, function (val) {
return val;
});
assert.isFalse(result);
});
it("calls the given callback once for each item in an iterable until it returns false", function () {
var iterableOne = [true, true, true, true];
var iterableTwo = [true, true, false, true];
var callback = sinon.spy(function (val) {
return val;
});
every(iterableOne, callback);
assert.equals(callback.callCount, 4);
callback.resetHistory();
every(iterableTwo, callback);
assert.equals(callback.callCount, 3);
});
});

View file

@ -1,29 +0,0 @@
"use strict";
/**
* Returns a display name for a function
*
* @param {Function} func
* @returns {string}
*/
module.exports = function functionName(func) {
if (!func) {
return "";
}
try {
return (
func.displayName ||
func.name ||
// Use function decomposition as a last resort to get function
// name. Does not rely on function decomposition to work - if it
// doesn't debugging will be slightly less informative
// (i.e. toString will say 'spy' rather than 'myFunc').
(String(func).match(/function ([^\s(]+)/) || [])[1]
);
} catch (e) {
// Stringify may fail and we might get an exception, as a last-last
// resort fall back to empty string.
return "";
}
};

View file

@ -1,76 +0,0 @@
"use strict";
var jsc = require("jsverify");
var refute = require("@sinonjs/referee-sinon").refute;
var functionName = require("./function-name");
describe("function-name", function () {
it("should return empty string if func is falsy", function () {
jsc.assertForall("falsy", function (fn) {
return functionName(fn) === "";
});
});
it("should use displayName by default", function () {
jsc.assertForall("nestring", function (displayName) {
var fn = { displayName: displayName };
return functionName(fn) === fn.displayName;
});
});
it("should use name if displayName is not available", function () {
jsc.assertForall("nestring", function (name) {
var fn = { name: name };
return functionName(fn) === fn.name;
});
});
it("should fallback to string parsing", function () {
jsc.assertForall("nat", function (naturalNumber) {
var name = `fn${naturalNumber}`;
var fn = {
toString: function () {
return `\nfunction ${name}`;
},
};
return functionName(fn) === name;
});
});
it("should not fail when a name cannot be found", function () {
refute.exception(function () {
var fn = {
toString: function () {
return "\nfunction (";
},
};
functionName(fn);
});
});
it("should not fail when toString is undefined", function () {
refute.exception(function () {
functionName(Object.create(null));
});
});
it("should not fail when toString throws", function () {
refute.exception(function () {
var fn;
try {
// eslint-disable-next-line no-eval
fn = eval("(function*() {})")().constructor;
} catch (e) {
// env doesn't support generators
return;
}
functionName(fn);
});
});
});

View file

@ -1,22 +0,0 @@
"use strict";
/**
* A reference to the global object
*
* @type {object} globalObject
*/
var globalObject;
/* istanbul ignore else */
if (typeof global !== "undefined") {
// Node
globalObject = global;
} else if (typeof window !== "undefined") {
// Browser
globalObject = window;
} else {
// WebWorker
globalObject = self;
}
module.exports = globalObject;

View file

@ -1,16 +0,0 @@
"use strict";
var assert = require("@sinonjs/referee-sinon").assert;
var globalObject = require("./global");
describe("global", function () {
before(function () {
if (typeof global === "undefined") {
this.skip();
}
});
it("is same as global", function () {
assert.same(globalObject, global);
});
});

View file

@ -1,14 +0,0 @@
"use strict";
module.exports = {
global: require("./global"),
calledInOrder: require("./called-in-order"),
className: require("./class-name"),
deprecated: require("./deprecated"),
every: require("./every"),
functionName: require("./function-name"),
orderByFirstCall: require("./order-by-first-call"),
prototypes: require("./prototypes"),
typeOf: require("./type-of"),
valueToString: require("./value-to-string"),
};

View file

@ -1,31 +0,0 @@
"use strict";
var assert = require("@sinonjs/referee-sinon").assert;
var index = require("./index");
var expectedMethods = [
"calledInOrder",
"className",
"every",
"functionName",
"orderByFirstCall",
"typeOf",
"valueToString",
];
var expectedObjectProperties = ["deprecated", "prototypes"];
describe("package", function () {
// eslint-disable-next-line mocha/no-setup-in-describe
expectedMethods.forEach(function (name) {
it(`should export a method named ${name}`, function () {
assert.isFunction(index[name]);
});
});
// eslint-disable-next-line mocha/no-setup-in-describe
expectedObjectProperties.forEach(function (name) {
it(`should export an object property named ${name}`, function () {
assert.isObject(index[name]);
});
});
});

View file

@ -1,36 +0,0 @@
"use strict";
var sort = require("./prototypes/array").sort;
var slice = require("./prototypes/array").slice;
/**
* @private
*/
function comparator(a, b) {
// uuid, won't ever be equal
var aCall = a.getCall(0);
var bCall = b.getCall(0);
var aId = (aCall && aCall.callId) || -1;
var bId = (bCall && bCall.callId) || -1;
return aId < bId ? -1 : 1;
}
/**
* A Sinon proxy object (fake, spy, stub)
*
* @typedef {object} SinonProxy
* @property {Function} getCall - A method that can return the first call
*/
/**
* Sorts an array of SinonProxy instances (fake, spy, stub) by their first call
*
* @param {SinonProxy[] | SinonProxy} spies
* @returns {SinonProxy[]}
*/
function orderByFirstCall(spies) {
return sort(slice(spies), comparator);
}
module.exports = orderByFirstCall;

View file

@ -1,52 +0,0 @@
"use strict";
var assert = require("@sinonjs/referee-sinon").assert;
var knuthShuffle = require("knuth-shuffle").knuthShuffle;
var sinon = require("@sinonjs/referee-sinon").sinon;
var orderByFirstCall = require("./order-by-first-call");
describe("orderByFirstCall", function () {
it("should order an Array of spies by the callId of the first call, ascending", function () {
// create an array of spies
var spies = [
sinon.spy(),
sinon.spy(),
sinon.spy(),
sinon.spy(),
sinon.spy(),
sinon.spy(),
];
// call all the spies
spies.forEach(function (spy) {
spy();
});
// add a few uncalled spies
spies.push(sinon.spy());
spies.push(sinon.spy());
// randomise the order of the spies
knuthShuffle(spies);
var sortedSpies = orderByFirstCall(spies);
assert.equals(sortedSpies.length, spies.length);
var orderedByFirstCall = sortedSpies.every(function (spy, index) {
if (index + 1 === sortedSpies.length) {
return true;
}
var nextSpy = sortedSpies[index + 1];
// uncalled spies should be ordered first
if (!spy.called) {
return true;
}
return spy.calledImmediatelyBefore(nextSpy);
});
assert.isTrue(orderedByFirstCall);
});
});

View file

@ -1,43 +0,0 @@
# Prototypes
The functions in this folder are to be use for keeping cached references to the built-in prototypes, so that people can't inadvertently break the library by making mistakes in userland.
See https://github.com/sinonjs/sinon/pull/1523
## Without cached references
```js
// in userland, the library user needs to replace the filter method on
// Array.prototype
var array = [1, 2, 3];
sinon.replace(array, "filter", sinon.fake.returns(2));
// in a sinon module, the library author needs to use the filter method
var someArray = ["a", "b", 42, "c"];
var answer = filter(someArray, function (v) {
return v === 42;
});
console.log(answer);
// => 2
```
## With cached references
```js
// in userland, the library user needs to replace the filter method on
// Array.prototype
var array = [1, 2, 3];
sinon.replace(array, "filter", sinon.fake.returns(2));
// in a sinon module, the library author needs to use the filter method
// get a reference to the original Array.prototype.filter
var filter = require("@sinonjs/commons").prototypes.array.filter;
var someArray = ["a", "b", 42, "c"];
var answer = filter(someArray, function (v) {
return v === 42;
});
console.log(answer);
// => 42
```

View file

@ -1,5 +0,0 @@
"use strict";
var copyPrototype = require("./copy-prototype-methods");
module.exports = copyPrototype(Array.prototype);

View file

@ -1,40 +0,0 @@
"use strict";
var call = Function.call;
var throwsOnProto = require("./throws-on-proto");
var disallowedProperties = [
// ignore size because it throws from Map
"size",
"caller",
"callee",
"arguments",
];
// This branch is covered when tests are run with `--disable-proto=throw`,
// however we can test both branches at the same time, so this is ignored
/* istanbul ignore next */
if (throwsOnProto) {
disallowedProperties.push("__proto__");
}
module.exports = function copyPrototypeMethods(prototype) {
// eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
return Object.getOwnPropertyNames(prototype).reduce(function (
result,
name
) {
if (disallowedProperties.includes(name)) {
return result;
}
if (typeof prototype[name] !== "function") {
return result;
}
result[name] = call.bind(prototype[name]);
return result;
},
Object.create(null));
};

View file

@ -1,12 +0,0 @@
"use strict";
var refute = require("@sinonjs/referee-sinon").refute;
var copyPrototypeMethods = require("./copy-prototype-methods");
describe("copyPrototypeMethods", function () {
it("does not throw for Map", function () {
refute.exception(function () {
copyPrototypeMethods(Map.prototype);
});
});
});

View file

@ -1,5 +0,0 @@
"use strict";
var copyPrototype = require("./copy-prototype-methods");
module.exports = copyPrototype(Function.prototype);

View file

@ -1,10 +0,0 @@
"use strict";
module.exports = {
array: require("./array"),
function: require("./function"),
map: require("./map"),
object: require("./object"),
set: require("./set"),
string: require("./string"),
};

View file

@ -1,61 +0,0 @@
"use strict";
var assert = require("@sinonjs/referee-sinon").assert;
var arrayProto = require("./index").array;
var functionProto = require("./index").function;
var mapProto = require("./index").map;
var objectProto = require("./index").object;
var setProto = require("./index").set;
var stringProto = require("./index").string;
var throwsOnProto = require("./throws-on-proto");
describe("prototypes", function () {
describe(".array", function () {
// eslint-disable-next-line mocha/no-setup-in-describe
verifyProperties(arrayProto, Array);
});
describe(".function", function () {
// eslint-disable-next-line mocha/no-setup-in-describe
verifyProperties(functionProto, Function);
});
describe(".map", function () {
// eslint-disable-next-line mocha/no-setup-in-describe
verifyProperties(mapProto, Map);
});
describe(".object", function () {
// eslint-disable-next-line mocha/no-setup-in-describe
verifyProperties(objectProto, Object);
});
describe(".set", function () {
// eslint-disable-next-line mocha/no-setup-in-describe
verifyProperties(setProto, Set);
});
describe(".string", function () {
// eslint-disable-next-line mocha/no-setup-in-describe
verifyProperties(stringProto, String);
});
});
function verifyProperties(p, origin) {
var disallowedProperties = ["size", "caller", "callee", "arguments"];
if (throwsOnProto) {
disallowedProperties.push("__proto__");
}
it("should have all the methods of the origin prototype", function () {
var methodNames = Object.getOwnPropertyNames(origin.prototype).filter(
function (name) {
if (disallowedProperties.includes(name)) {
return false;
}
return typeof origin.prototype[name] === "function";
}
);
methodNames.forEach(function (name) {
assert.isTrue(Object.prototype.hasOwnProperty.call(p, name), name);
});
});
}

Some files were not shown because too many files have changed in this diff Show more