From 7c28120227ed2228fe9b16a188a6c68780d2002f Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Thu, 12 Nov 2020 15:07:55 +1300 Subject: [PATCH 01/22] refactor: move src file to src/ --- rollup.config.js | 2 +- index.js => src/index.js | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename index.js => src/index.js (100%) diff --git a/rollup.config.js b/rollup.config.js index 7ce9d62..cd5527c 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -5,7 +5,7 @@ import commonjs from '@rollup/plugin-commonjs' import pkg from './package.json' export default { - input: `index.js`, + input: `src/index.js`, plugins: [ commonjs(), resolve(), diff --git a/index.js b/src/index.js similarity index 100% rename from index.js rename to src/index.js From 79b38375818666bc80f2a2d3a3eaace9b10748ad Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Thu, 12 Nov 2020 15:10:08 +1300 Subject: [PATCH 02/22] refactor: move typedefs to types/ --- package.json | 1 + index.d.ts => types/index.d.ts | 0 2 files changed, 1 insertion(+) rename index.d.ts => types/index.d.ts (100%) diff --git a/package.json b/package.json index 4755c1b..e6b57b1 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ }, "license": "MIT", "main": "dist/cjs.js", + "types": "types/index.d.ts", "files": [ "/dist", "index.d.ts", diff --git a/index.d.ts b/types/index.d.ts similarity index 100% rename from index.d.ts rename to types/index.d.ts From 86d93385426a4fb120d1e4b59d66becf67db4cd3 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Fri, 22 Jan 2021 00:49:25 +1300 Subject: [PATCH 03/22] build: setup for convertion to typescript --- package-lock.json | 16 ++++++++++++++++ package.json | 2 ++ rollup.config.js | 21 +++++++++++++-------- src/{index.js => index.ts} | 0 tsconfig.base.json | 17 +++++++++++++++++ tsconfig.json | 4 ++++ 6 files changed, 52 insertions(+), 8 deletions(-) rename src/{index.js => index.ts} (100%) create mode 100644 tsconfig.base.json create mode 100644 tsconfig.json diff --git a/package-lock.json b/package-lock.json index 1ea930b..75bae1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -104,6 +104,16 @@ } } }, + "@rollup/plugin-typescript": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.1.0.tgz", + "integrity": "sha512-pyQlcGQYRsONUDwXK3ckGPHjPzmjlq4sinzr7emW8ZMb2oZjg9WLcdcP8wyHSvBjvHrLzMayyPy079RROqb4vw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "resolve": "^1.17.0" + } + }, "@rollup/pluginutils": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", @@ -931,6 +941,12 @@ "yn": "3.1.1" } }, + "tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", + "dev": true + }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", diff --git a/package.json b/package.json index e6b57b1..63fbe00 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "devDependencies": { "@rollup/plugin-commonjs": "^16.0.0", "@rollup/plugin-node-resolve": "^10.0.0", + "@rollup/plugin-typescript": "^8.1.0", "@types/node": "^8.10.54", "is-mergeable-object": "1.1.0", "is-plain-obj": "^3.0.0", @@ -43,6 +44,7 @@ "tape": "^5.0.1", "terser": "^5.5.1", "ts-node": "^9.0.0", + "tslib": "^2.1.0", "typescript": "^4.1.2" }, "engines": { diff --git a/rollup.config.js b/rollup.config.js index cd5527c..b58fde3 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,24 +1,29 @@ // @ts-check -import resolve from '@rollup/plugin-node-resolve' -import commonjs from '@rollup/plugin-commonjs' -import pkg from './package.json' +import commonjs from "@rollup/plugin-commonjs" +import resolve from "@rollup/plugin-node-resolve" +import typescript from "@rollup/plugin-typescript" + +import pkg from "./package.json" export default { - input: `src/index.js`, + input: `src/index.ts`, + plugins: [ commonjs(), resolve(), + typescript(), ], + output: [ { file: pkg.main, - format: `cjs` + format: `cjs`, }, { - name: 'deepmerge', - file: 'dist/umd.js', - format: `umd` + name: `deepmerge`, + file: `dist/umd.js`, + format: `umd`, }, ], } diff --git a/src/index.js b/src/index.ts similarity index 100% rename from src/index.js rename to src/index.ts diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 0000000..436984c --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2015", + "module": "ESNext", + "lib": [ + "ESNext" + ], + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "alwaysStrict": true, + "noImplicitAny": false, + "strict": true, + "forceConsistentCasingInFileNames": true, + "newLine": "LF" + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..fe5bccc --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.base.json", + "include": ["./src"] +} From 85cf74e58cc15cac6e083c76dc99f651c7ac71e3 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Fri, 22 Jan 2021 00:50:36 +1300 Subject: [PATCH 04/22] build: remove manual typings --- .gitignore | 5 +++-- types/index.d.ts | 16 ---------------- 2 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 types/index.d.ts diff --git a/.gitignore b/.gitignore index b0fb09f..8dd9358 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -node_modules -dist/* +/node_modules +/dist/* +/types/* diff --git a/types/index.d.ts b/types/index.d.ts deleted file mode 100644 index 20f645a..0000000 --- a/types/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T; -declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T1 & T2; - -declare namespace deepmerge { - export interface Options { - arrayMerge?(target: any[], source: any[], options?: Options): any[]; - clone?: boolean; - customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined; - isMergeable?(value: object): boolean; - } - - export function all (objects: object[], options?: Options): object; - export function all (objects: Partial[], options?: Options): T; -} - -export = deepmerge; From 96dc11d8d533ce145fb39777b8ae6312981648d9 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Fri, 22 Jan 2021 02:19:11 +1300 Subject: [PATCH 05/22] refactor: adjust code style --- src/index.ts | 83 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 34 deletions(-) diff --git a/src/index.ts b/src/index.ts index 033b8cf..47d38c7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,20 +1,26 @@ -const isPlainObj = require(`is-plain-obj`) +import isPlainObj from "is-plain-obj" -const defaultIsMergeable = value => Array.isArray(value) || isPlainObj(value) -const emptyTarget = value => Array.isArray(value) ? [] : {} +function defaultIsMergeable(value) { + return Array.isArray(value) || isPlainObj(value) +} + +function emptyTarget(value) { + return Array.isArray(value) ? [] : {} +} -const cloneUnlessOtherwiseSpecified = (value, options) => { +function cloneUnlessOtherwiseSpecified(value, options) { return (options.clone && options.isMergeable(value)) ? deepmerge(emptyTarget(value), value, options) : value } -const defaultArrayMerge = (target, source, options) => { - return target.concat(source) - .map(element => cloneUnlessOtherwiseSpecified(element, options)) +function defaultArrayMerge(target, source, options) { + return target + .concat(source) + .map((element) => cloneUnlessOtherwiseSpecified(element, options)) } -const getMergeFunction = (key, options) => { +function getMergeFunction(key, options) { if (!options.customMerge) { return deepmerge } @@ -23,45 +29,54 @@ const getMergeFunction = (key, options) => { return typeof customMerge === `function` ? customMerge : deepmerge } -const getEnumerableOwnPropertySymbols = target => { +function getEnumerableOwnPropertySymbols(target) { return Object.getOwnPropertySymbols - ? Object.getOwnPropertySymbols(target) - .filter(symbol => target.propertyIsEnumerable(symbol)) + ? Object.getOwnPropertySymbols(target).filter((symbol) => + Object.prototype.propertyIsEnumerable.call(target, symbol), + ) : [] } -const getKeys = target => Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +} -const propertyIsOnObject = (object, property) => { +function propertyIsOnObject(object, property) { try { return property in object - } catch (_) { + } catch { return false } } // Protects from prototype poisoning and unexpected merging up the prototype chain. -const propertyIsUnsafe = (target, key) => { +function propertyIsUnsafe(target, key) { return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. } -const mergeObject = (target, source, options) => { +function mergeObject(target, source, options) { const destination = options.clone ? emptyTarget(target) : target if (options.isMergeable(target)) { - getKeys(target) - .forEach(key => destination[key] = cloneUnlessOtherwiseSpecified(target[key], options)) + getKeys(target).forEach( + (key) => + (destination[key] = cloneUnlessOtherwiseSpecified(target[key], options)), + ) } - getKeys(source).forEach(key => { + getKeys(source).forEach((key) => { if (propertyIsUnsafe(target, key)) { return } if (propertyIsOnObject(target, key) && options.isMergeable(source[key])) { - destination[key] = getMergeFunction(key, options)(target[key], source[key], options) + destination[key] = getMergeFunction(key, options)( + target[key], + source[key], + options, + ) } else { destination[key] = cloneUnlessOtherwiseSpecified(source[key], options) } @@ -70,17 +85,19 @@ const mergeObject = (target, source, options) => { return destination } -const cloneOptionsWithDefault = inputOptions => ({ - arrayMerge: defaultArrayMerge, - isMergeable: defaultIsMergeable, - clone: true, - ...inputOptions, - // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() - // implementations can use it. The caller may not replace it. - cloneUnlessOtherwiseSpecified: cloneUnlessOtherwiseSpecified -}) - -const deepmerge = (target, source, inputOptions) => { +function cloneOptionsWithDefault(inputOptions) { + return { + arrayMerge: defaultArrayMerge, + isMergeable: defaultIsMergeable, + clone: true, + ...inputOptions, + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + cloneUnlessOtherwiseSpecified, + } +} + +export function deepmerge(target, source, inputOptions) { const options = cloneOptionsWithDefault(inputOptions) const sourceIsArray = Array.isArray(source) @@ -95,7 +112,7 @@ const deepmerge = (target, source, inputOptions) => { return mergeObject(target, source, options) } -deepmerge.all = (array, inputOptions) => { +export function deepmergeAll(array, inputOptions) { if (!Array.isArray(array)) { throw new Error(`first argument should be an array`) } @@ -113,5 +130,3 @@ deepmerge.all = (array, inputOptions) => { return array.reduce((prev, next) => deepmerge(prev, next, options)) } - -module.exports = deepmerge From 55865c7a47688862077f624b1fb87acae9b040e9 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Fri, 22 Jan 2021 02:57:32 +1300 Subject: [PATCH 06/22] refactor: move implementation out of index file --- src/deepmerge.ts | 132 ++++++++++++++++++++++++++++++++++++++++++++++ src/index.ts | 133 +---------------------------------------------- 2 files changed, 133 insertions(+), 132 deletions(-) create mode 100644 src/deepmerge.ts diff --git a/src/deepmerge.ts b/src/deepmerge.ts new file mode 100644 index 0000000..47d38c7 --- /dev/null +++ b/src/deepmerge.ts @@ -0,0 +1,132 @@ +import isPlainObj from "is-plain-obj" + +function defaultIsMergeable(value) { + return Array.isArray(value) || isPlainObj(value) +} + +function emptyTarget(value) { + return Array.isArray(value) ? [] : {} +} + +function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone && options.isMergeable(value)) + ? deepmerge(emptyTarget(value), value, options) + : value +} + +function defaultArrayMerge(target, source, options) { + return target + .concat(source) + .map((element) => cloneUnlessOtherwiseSpecified(element, options)) +} + +function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge + } + + const customMerge = options.customMerge(key) + return typeof customMerge === `function` ? customMerge : deepmerge +} + +function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols + ? Object.getOwnPropertySymbols(target).filter((symbol) => + Object.prototype.propertyIsEnumerable.call(target, symbol), + ) + : [] +} + +function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +} + +function propertyIsOnObject(object, property) { + try { + return property in object + } catch { + return false + } +} + +// Protects from prototype poisoning and unexpected merging up the prototype chain. +function propertyIsUnsafe(target, key) { + return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, + && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, + && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. +} + +function mergeObject(target, source, options) { + const destination = options.clone ? emptyTarget(target) : target + + if (options.isMergeable(target)) { + getKeys(target).forEach( + (key) => + (destination[key] = cloneUnlessOtherwiseSpecified(target[key], options)), + ) + } + + getKeys(source).forEach((key) => { + if (propertyIsUnsafe(target, key)) { + return + } + + if (propertyIsOnObject(target, key) && options.isMergeable(source[key])) { + destination[key] = getMergeFunction(key, options)( + target[key], + source[key], + options, + ) + } else { + destination[key] = cloneUnlessOtherwiseSpecified(source[key], options) + } + }) + + return destination +} + +function cloneOptionsWithDefault(inputOptions) { + return { + arrayMerge: defaultArrayMerge, + isMergeable: defaultIsMergeable, + clone: true, + ...inputOptions, + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + cloneUnlessOtherwiseSpecified, + } +} + +export function deepmerge(target, source, inputOptions) { + const options = cloneOptionsWithDefault(inputOptions) + + const sourceIsArray = Array.isArray(source) + const targetIsArray = Array.isArray(target) + const sourceAndTargetTypesMatch = sourceIsArray === targetIsArray + + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source, options) + } else if (sourceIsArray) { + return options.arrayMerge(target, source, options) + } + return mergeObject(target, source, options) +} + +export function deepmergeAll(array, inputOptions) { + if (!Array.isArray(array)) { + throw new Error(`first argument should be an array`) + } + + const options = cloneOptionsWithDefault(inputOptions) + + if (array.length === 0) { + return {} + } else if (array.length === 1) { + const value = array[0] + return options.clone + ? deepmerge(emptyTarget(value), value, options) + : value + } + + return array.reduce((prev, next) => deepmerge(prev, next, options)) +} diff --git a/src/index.ts b/src/index.ts index 47d38c7..9a28ec4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,132 +1 @@ -import isPlainObj from "is-plain-obj" - -function defaultIsMergeable(value) { - return Array.isArray(value) || isPlainObj(value) -} - -function emptyTarget(value) { - return Array.isArray(value) ? [] : {} -} - -function cloneUnlessOtherwiseSpecified(value, options) { - return (options.clone && options.isMergeable(value)) - ? deepmerge(emptyTarget(value), value, options) - : value -} - -function defaultArrayMerge(target, source, options) { - return target - .concat(source) - .map((element) => cloneUnlessOtherwiseSpecified(element, options)) -} - -function getMergeFunction(key, options) { - if (!options.customMerge) { - return deepmerge - } - - const customMerge = options.customMerge(key) - return typeof customMerge === `function` ? customMerge : deepmerge -} - -function getEnumerableOwnPropertySymbols(target) { - return Object.getOwnPropertySymbols - ? Object.getOwnPropertySymbols(target).filter((symbol) => - Object.prototype.propertyIsEnumerable.call(target, symbol), - ) - : [] -} - -function getKeys(target) { - return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) -} - -function propertyIsOnObject(object, property) { - try { - return property in object - } catch { - return false - } -} - -// Protects from prototype poisoning and unexpected merging up the prototype chain. -function propertyIsUnsafe(target, key) { - return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, - && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, - && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. -} - -function mergeObject(target, source, options) { - const destination = options.clone ? emptyTarget(target) : target - - if (options.isMergeable(target)) { - getKeys(target).forEach( - (key) => - (destination[key] = cloneUnlessOtherwiseSpecified(target[key], options)), - ) - } - - getKeys(source).forEach((key) => { - if (propertyIsUnsafe(target, key)) { - return - } - - if (propertyIsOnObject(target, key) && options.isMergeable(source[key])) { - destination[key] = getMergeFunction(key, options)( - target[key], - source[key], - options, - ) - } else { - destination[key] = cloneUnlessOtherwiseSpecified(source[key], options) - } - }) - - return destination -} - -function cloneOptionsWithDefault(inputOptions) { - return { - arrayMerge: defaultArrayMerge, - isMergeable: defaultIsMergeable, - clone: true, - ...inputOptions, - // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() - // implementations can use it. The caller may not replace it. - cloneUnlessOtherwiseSpecified, - } -} - -export function deepmerge(target, source, inputOptions) { - const options = cloneOptionsWithDefault(inputOptions) - - const sourceIsArray = Array.isArray(source) - const targetIsArray = Array.isArray(target) - const sourceAndTargetTypesMatch = sourceIsArray === targetIsArray - - if (!sourceAndTargetTypesMatch) { - return cloneUnlessOtherwiseSpecified(source, options) - } else if (sourceIsArray) { - return options.arrayMerge(target, source, options) - } - return mergeObject(target, source, options) -} - -export function deepmergeAll(array, inputOptions) { - if (!Array.isArray(array)) { - throw new Error(`first argument should be an array`) - } - - const options = cloneOptionsWithDefault(inputOptions) - - if (array.length === 0) { - return {} - } else if (array.length === 1) { - const value = array[0] - return options.clone - ? deepmerge(emptyTarget(value), value, options) - : value - } - - return array.reduce((prev, next) => deepmerge(prev, next, options)) -} +export { deepmerge, deepmergeAll } from "./deepmerge" From 795e78b4c76ce96f5ce96cda878e4388a95e6a16 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Fri, 22 Jan 2021 03:08:10 +1300 Subject: [PATCH 07/22] refactor: move utility functions to an utils file --- src/deepmerge.ts | 54 +++++++----------------------------------------- src/utils.ts | 47 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 46 deletions(-) create mode 100644 src/utils.ts diff --git a/src/deepmerge.ts b/src/deepmerge.ts index 47d38c7..9c24b90 100644 --- a/src/deepmerge.ts +++ b/src/deepmerge.ts @@ -1,61 +1,23 @@ import isPlainObj from "is-plain-obj" +import { + cloneUnlessOtherwiseSpecified, + getKeys, + getMergeFunction, + propertyIsOnObject, + propertyIsUnsafe, +} from "./utils" + function defaultIsMergeable(value) { return Array.isArray(value) || isPlainObj(value) } -function emptyTarget(value) { - return Array.isArray(value) ? [] : {} -} - -function cloneUnlessOtherwiseSpecified(value, options) { - return (options.clone && options.isMergeable(value)) - ? deepmerge(emptyTarget(value), value, options) - : value -} - function defaultArrayMerge(target, source, options) { return target .concat(source) .map((element) => cloneUnlessOtherwiseSpecified(element, options)) } -function getMergeFunction(key, options) { - if (!options.customMerge) { - return deepmerge - } - - const customMerge = options.customMerge(key) - return typeof customMerge === `function` ? customMerge : deepmerge -} - -function getEnumerableOwnPropertySymbols(target) { - return Object.getOwnPropertySymbols - ? Object.getOwnPropertySymbols(target).filter((symbol) => - Object.prototype.propertyIsEnumerable.call(target, symbol), - ) - : [] -} - -function getKeys(target) { - return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) -} - -function propertyIsOnObject(object, property) { - try { - return property in object - } catch { - return false - } -} - -// Protects from prototype poisoning and unexpected merging up the prototype chain. -function propertyIsUnsafe(target, key) { - return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, - && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, - && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. -} - function mergeObject(target, source, options) { const destination = options.clone ? emptyTarget(target) : target diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 0000000..545b31e --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,47 @@ +import { deepmerge } from './deepmerge' + +function emptyTarget(value) { + return Array.isArray(value) ? [] : {} +} + +export function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone && options.isMergeable(value)) + ? deepmerge(emptyTarget(value), value, options) + : value +} + +function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols + ? Object.getOwnPropertySymbols(target).filter((symbol) => + Object.prototype.propertyIsEnumerable.call(target, symbol), + ) + : [] +} + +export function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +} + +export function propertyIsOnObject(object, property) { + try { + return property in object + } catch { + return false + } +} + +export function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge + } + + const customMerge = options.customMerge(key) + return typeof customMerge === `function` ? customMerge : deepmerge +} + +// Protects from prototype poisoning and unexpected merging up the prototype chain. +export function propertyIsUnsafe(target, key) { + return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, + && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, + && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. +} From b1aacd57307961869fa340a8d70e8574abdd6425 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Fri, 22 Jan 2021 03:13:04 +1300 Subject: [PATCH 08/22] refactor: move options functions to an options file --- src/deepmerge.ts | 16 ++++------------ src/options.ts | 13 +++++++++++++ 2 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 src/options.ts diff --git a/src/deepmerge.ts b/src/deepmerge.ts index 9c24b90..de84b1b 100644 --- a/src/deepmerge.ts +++ b/src/deepmerge.ts @@ -1,5 +1,7 @@ -import isPlainObj from "is-plain-obj" - +import { + defaultArrayMerge, + defaultIsMergeable, +} from "./options" import { cloneUnlessOtherwiseSpecified, getKeys, @@ -8,16 +10,6 @@ import { propertyIsUnsafe, } from "./utils" -function defaultIsMergeable(value) { - return Array.isArray(value) || isPlainObj(value) -} - -function defaultArrayMerge(target, source, options) { - return target - .concat(source) - .map((element) => cloneUnlessOtherwiseSpecified(element, options)) -} - function mergeObject(target, source, options) { const destination = options.clone ? emptyTarget(target) : target diff --git a/src/options.ts b/src/options.ts new file mode 100644 index 0000000..2e2d493 --- /dev/null +++ b/src/options.ts @@ -0,0 +1,13 @@ +import isPlainObj from "is-plain-obj" + +import { cloneUnlessOtherwiseSpecified } from "./utils" + +export function defaultIsMergeable(value) { + return Array.isArray(value) || isPlainObj(value) +} + +export function defaultArrayMerge(target, source, options) { + return target + .concat(source) + .map((element) => cloneUnlessOtherwiseSpecified(element, options)) +} From 64a3075d93db150abc0f57aa38abfd84954c7924 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Fri, 22 Jan 2021 03:21:30 +1300 Subject: [PATCH 09/22] perf: only compute the full options on the top level call --- src/deepmerge.ts | 29 ++++++++--------------------- src/options.ts | 25 +++++++++++++++++++++++-- src/utils.ts | 8 ++++---- 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/deepmerge.ts b/src/deepmerge.ts index de84b1b..4c951fa 100644 --- a/src/deepmerge.ts +++ b/src/deepmerge.ts @@ -1,7 +1,4 @@ -import { - defaultArrayMerge, - defaultIsMergeable, -} from "./options" +import { getFullOptions } from "./options" import { cloneUnlessOtherwiseSpecified, getKeys, @@ -39,21 +36,7 @@ function mergeObject(target, source, options) { return destination } -function cloneOptionsWithDefault(inputOptions) { - return { - arrayMerge: defaultArrayMerge, - isMergeable: defaultIsMergeable, - clone: true, - ...inputOptions, - // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() - // implementations can use it. The caller may not replace it. - cloneUnlessOtherwiseSpecified, - } -} - -export function deepmerge(target, source, inputOptions) { - const options = cloneOptionsWithDefault(inputOptions) - +export function deepmergeImpl(target, source, options) { const sourceIsArray = Array.isArray(source) const targetIsArray = Array.isArray(target) const sourceAndTargetTypesMatch = sourceIsArray === targetIsArray @@ -66,12 +49,16 @@ export function deepmerge(target, source, inputOptions) { return mergeObject(target, source, options) } +export function deepmerge(target, source, inputOptions) { + return deepmergeImpl(target, source, getFullOptions(inputOptions)) +} + export function deepmergeAll(array, inputOptions) { if (!Array.isArray(array)) { throw new Error(`first argument should be an array`) } - const options = cloneOptionsWithDefault(inputOptions) + const options = getFullOptions(inputOptions) if (array.length === 0) { return {} @@ -82,5 +69,5 @@ export function deepmergeAll(array, inputOptions) { : value } - return array.reduce((prev, next) => deepmerge(prev, next, options)) + return array.reduce((prev, next) => deepmergeImpl(prev, next, options)) } diff --git a/src/options.ts b/src/options.ts index 2e2d493..f9c47a5 100644 --- a/src/options.ts +++ b/src/options.ts @@ -2,12 +2,33 @@ import isPlainObj from "is-plain-obj" import { cloneUnlessOtherwiseSpecified } from "./utils" -export function defaultIsMergeable(value) { +function defaultIsMergeable(value) { return Array.isArray(value) || isPlainObj(value) } -export function defaultArrayMerge(target, source, options) { +function defaultArrayMerge(target, source, options) { return target .concat(source) .map((element) => cloneUnlessOtherwiseSpecified(element, options)) } + +export function getFullOptions(inputOptions) { + const overrides = inputOptions === undefined + ? undefined + : Object.fromEntries( + // Filter out keys explicitly set to undefined. + Object.entries(inputOptions).filter( + ([ _key, value ]) => value !== undefined, + ), + ) + + return { + arrayMerge: defaultArrayMerge, + isMergeable: defaultIsMergeable, + clone: false, + ...overrides, + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + cloneUnlessOtherwiseSpecified, + } +} diff --git a/src/utils.ts b/src/utils.ts index 545b31e..c3a2dd9 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,4 @@ -import { deepmerge } from './deepmerge' +import { deepmergeImpl } from './deepmerge' function emptyTarget(value) { return Array.isArray(value) ? [] : {} @@ -6,7 +6,7 @@ function emptyTarget(value) { export function cloneUnlessOtherwiseSpecified(value, options) { return (options.clone && options.isMergeable(value)) - ? deepmerge(emptyTarget(value), value, options) + ? deepmergeImpl(emptyTarget(value), value, options) : value } @@ -32,11 +32,11 @@ export function propertyIsOnObject(object, property) { export function getMergeFunction(key, options) { if (!options.customMerge) { - return deepmerge + return deepmergeImpl } const customMerge = options.customMerge(key) - return typeof customMerge === `function` ? customMerge : deepmerge + return typeof customMerge === `function` ? customMerge : deepmergeImpl } // Protects from prototype poisoning and unexpected merging up the prototype chain. From 64d6d2a632a4742789c051c03b4a6a4973fa083c Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Fri, 22 Jan 2021 03:56:22 +1300 Subject: [PATCH 10/22] feat: add types --- .gitignore | 2 +- package.json | 9 ++- src/deepmerge.ts | 82 +++++++++++++++---- src/index.ts | 1 + src/options.ts | 74 +++++++++++++++-- src/types.ts | 182 ++++++++++++++++++++++++++++++++++++++++++ src/utils.ts | 27 ++++--- tsconfig.typedef.json | 9 +++ 8 files changed, 348 insertions(+), 38 deletions(-) create mode 100644 src/types.ts create mode 100644 tsconfig.typedef.json diff --git a/.gitignore b/.gitignore index 8dd9358..7d43580 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /node_modules /dist/* -/types/* +/types/current/* diff --git a/package.json b/package.json index 63fbe00..4ef2e48 100644 --- a/package.json +++ b/package.json @@ -17,16 +17,19 @@ }, "license": "MIT", "main": "dist/cjs.js", - "types": "types/index.d.ts", + "types": "types/current/index.d.ts", "files": [ - "/dist", + "dist/", + "types/", "index.d.ts", "changelog.md", "license.txt", "readme.md" ], "scripts": { - "build": "rollup -c", + "build": "npm run build:js && npm run build:types", + "build:js": "rollup -c", + "build:types": "tsc -p tsconfig.typedef.json", "size": "npm run build && terser --compress --mangle -- ./dist/umd.js | gzip -c | wc -c", "test": "npm run build && tape test/*.js && jsmd readme.md && npm run test:typescript", "test:typescript": "tsc --noEmit test/typescript.ts && ts-node test/typescript.ts" diff --git a/src/deepmerge.ts b/src/deepmerge.ts index 4c951fa..4e164ae 100644 --- a/src/deepmerge.ts +++ b/src/deepmerge.ts @@ -1,14 +1,21 @@ +import type { ExplicitOptions, FullOptions, Options } from "./options" import { getFullOptions } from "./options" +import type { DeepMerge, DeepMergeAll, DeepMergeObjects, Property } from "./types" import { cloneUnlessOtherwiseSpecified, + emptyTarget, getKeys, getMergeFunction, propertyIsOnObject, propertyIsUnsafe, } from "./utils" -function mergeObject(target, source, options) { - const destination = options.clone ? emptyTarget(target) : target +function mergeObject< + T1 extends Record, + T2 extends Record, + O extends Options +>(target: T1, source: T2, options: FullOptions): DeepMergeObjects { + const destination: any = options.clone ? emptyTarget(target) : target if (options.isMergeable(target)) { getKeys(target).forEach( @@ -36,38 +43,79 @@ function mergeObject(target, source, options) { return destination } -export function deepmergeImpl(target, source, options) { +export function deepmergeImpl( + target: T1, + source: T2, + options: FullOptions, +): DeepMerge> { const sourceIsArray = Array.isArray(source) const targetIsArray = Array.isArray(target) const sourceAndTargetTypesMatch = sourceIsArray === targetIsArray if (!sourceAndTargetTypesMatch) { - return cloneUnlessOtherwiseSpecified(source, options) + return cloneUnlessOtherwiseSpecified(source, options) as DeepMerge> } else if (sourceIsArray) { - return options.arrayMerge(target, source, options) + return options.arrayMerge( + target as Array, + source as Array, + options, + ) as DeepMerge> } - return mergeObject(target, source, options) + return mergeObject( + target as Record, + source as Record, + options, + ) as DeepMerge> } -export function deepmerge(target, source, inputOptions) { - return deepmergeImpl(target, source, getFullOptions(inputOptions)) +/** + * Deeply merge two objects. + * + * @param target The first object. + * @param source The second object. + * @param options Deep merge options. + */ +export function deepmerge< + T1 extends object, + T2 extends object, + O extends Options = {} +>(target: T1, source: T2, options?: O): DeepMerge> { + return deepmergeImpl(target, source, getFullOptions(options)) } -export function deepmergeAll(array, inputOptions) { - if (!Array.isArray(array)) { +/** + * Deeply merge two or more objects. + * + * @param objects An tuple of the objects to merge. + * @param options Deep merge options. + */ +export function deepmergeAll< + Ts extends readonly [object, ...Array], + O extends Options = {} +>(objects: [...Ts], options?: O): DeepMergeAll> + +/** + * Deeply merge two or more objects. + * + * @param objects An array of the objects to merge. + * @param options Deep merge options. + */ +export function deepmergeAll(objects: ReadonlyArray, options?: Options): object +export function deepmergeAll(objects: ReadonlyArray, options?: Options): object { + if (!Array.isArray(objects)) { throw new Error(`first argument should be an array`) } - const options = getFullOptions(inputOptions) + const fullOptions = getFullOptions(options) - if (array.length === 0) { + if (objects.length === 0) { return {} - } else if (array.length === 1) { - const value = array[0] - return options.clone - ? deepmerge(emptyTarget(value), value, options) + } else if (objects.length === 1) { + const value = objects[0] + return fullOptions.clone + ? deepmergeImpl(emptyTarget(value), value, fullOptions) : value } - return array.reduce((prev, next) => deepmergeImpl(prev, next, options)) + return objects.reduce((prev, next) => deepmergeImpl(prev, next, fullOptions), {}) } diff --git a/src/index.ts b/src/index.ts index 9a28ec4..4b2c6c8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1,2 @@ export { deepmerge, deepmergeAll } from "./deepmerge" +export type { Options } from "./options" diff --git a/src/options.ts b/src/options.ts index f9c47a5..d80ee4b 100644 --- a/src/options.ts +++ b/src/options.ts @@ -1,18 +1,76 @@ import isPlainObj from "is-plain-obj" +import type { Property } from "./types" import { cloneUnlessOtherwiseSpecified } from "./utils" -function defaultIsMergeable(value) { +/** + * deepmerge's options. + */ +export type Options = Partial<{ + arrayMerge?: ArrayMerge + clone?: boolean + customMerge?: ObjectMerge + isMergeable?: IsMergeable +}> + +/** + * deepmerge's options with explicit keys. + */ +export type ExplicitOptions = { + [K in keyof Options]-?: undefined extends O[K] ? never : O[K] +} + +/** + * deepmerge's options with defaults applied. + */ +export type FullOptions = { + arrayMerge: O[`arrayMerge`] extends undefined + ? typeof defaultArrayMerge + : NonNullable + clone: O[`clone`] extends undefined ? true : NonNullable + customMerge?: O[`customMerge`] + isMergeable: O[`isMergeable`] extends undefined + ? typeof defaultIsMergeable + : NonNullable + cloneUnlessOtherwiseSpecified: (value: T, options: FullOptions) => T +} + +/** + * A function that determins if a type is mergable. + */ +export type IsMergeable = (value: any) => boolean + +/** + * A function that merges any 2 arrays. + */ +export type ArrayMerge = (target: Array, source: Array, options: FullOptions) => any + +/** + * A function that merges any 2 non-arrays values. + */ +export type ObjectMerge = ( + key: K +) => ((target: any, source: any, options: FullOptions) => any) | undefined + + +function defaultIsMergeable(value: unknown): value is Record | Array { return Array.isArray(value) || isPlainObj(value) } -function defaultArrayMerge(target, source, options) { - return target - .concat(source) - .map((element) => cloneUnlessOtherwiseSpecified(element, options)) +function defaultArrayMerge( + target: ReadonlyArray, + source: ReadonlyArray, + options: FullOptions, +) { + return [ ...target, ...source ] + .map((element) => cloneUnlessOtherwiseSpecified(element, options)) as T1 extends readonly [...infer E1] + ? T2 extends readonly [...infer E2] + ? [...E1, ...E2] + : never + : never } -export function getFullOptions(inputOptions) { +export function getFullOptions(inputOptions?: O) { const overrides = inputOptions === undefined ? undefined : Object.fromEntries( @@ -20,7 +78,7 @@ export function getFullOptions(inputOptions) { Object.entries(inputOptions).filter( ([ _key, value ]) => value !== undefined, ), - ) + ) as O return { arrayMerge: defaultArrayMerge, @@ -30,5 +88,5 @@ export function getFullOptions(inputOptions) { // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() // implementations can use it. The caller may not replace it. cloneUnlessOtherwiseSpecified, - } + } as FullOptions } diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..10cd721 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,182 @@ +import type { Options } from "./options" + +/** + * Deep merge 1 or more types given in an array. + */ +export type DeepMergeAll< + Ts extends readonly [any, ...Array], + O extends Options +> = Ts extends readonly [infer T1, ...Array] + ? Ts extends readonly [T1, infer T2, ...infer TRest] + ? TRest extends ReadonlyArray + ? DeepMerge + : DeepMerge, O> + : T1 + : never + +/** + * Deep merge 2 types. + */ +export type DeepMerge = IsSame extends true + ? T1 | T2 + : And, IsObjectOrArray> extends true + ? DeepMergeValues + : Leaf + +/** + * Deep merge 2 objects (they may be arrays). + */ +type DeepMergeValues = And, IsArray> extends true + ? DeepMergeArrays + : And, IsObject> extends true + ? DeepMergeObjects + : Leaf + +/** + * Deep merge 2 non-array objects. + */ +export type DeepMergeObjects = FlatternAlias< + // @see https://github.com/microsoft/TypeScript/issues/41448 + { + -readonly [K in keyof T1]: DeepMergeObjectProps, ValueOfKey, O> + } & + { + -readonly [K in keyof T2]: DeepMergeObjectProps, ValueOfKey, O> + } +> + +/** + * Deep merge 2 types that are known to be properties of an object being deeply + * merged. + */ +type DeepMergeObjectProps = Or< + IsUndefinedOrNever, + IsUndefinedOrNever +> extends true + ? Leaf + : IsUndefinedOrNever extends true + ? IsUndefinedOrNever extends true + ? DeepMerge + : DeepMergeObjectPropsCustom + : MaybeLeaf + +/** + * Deep merge 2 types that are known to be properties of an object being deeply + * merged and where a "customMerge" function has been provided. + */ +type DeepMergeObjectPropsCustom = ReturnType< + NonNullable +> extends undefined + ? DeepMerge + : undefined extends ReturnType> + ? Or, IsArray> extends true + ? And, IsArray> extends true + ? DeepMergeArrays + : Leaf + : DeepMerge | ReturnType>>> + : ReturnType>>> + +/** + * Deep merge 2 arrays. + * + * Cannot get return type from arrayMerge passing generics. + * TypeScript does not yet support higher order types. + * @see https://github.com/Microsoft/TypeScript/issues/1213 + */ +type DeepMergeArrays = IsUndefinedOrNever extends true + ? T1 extends readonly [...infer E1] + ? T2 extends readonly [...infer E2] + ? [...E1, ...E2] + : never + : never + : ReturnType> + +/** + * Get the leaf type from 2 types that can't be merged. + */ +type Leaf = IsNever extends true + ? T1 + : IsNever extends true + ? T2 + : IsUndefinedOrNever extends true + ? T1 + : T2 + +/** + * Get the leaf type from 2 types that might not be able to be merged. + */ +type MaybeLeaf = Or< + Or, IsUndefinedOrNever>, + Not, IsObjectOrArray>> +> extends true + ? Leaf + : // TODO: Handle case where return type of "isMergeable" is a typeguard. If it is we can do better than just "unknown". + unknown + +/** + * Flatten a complex type such as a union or intersection of objects into a + * single object. + */ +type FlatternAlias = {} & { [P in keyof T]: T[P] } + +/** + * Get the value of the given key in the given object. + */ +type ValueOfKey = K extends keyof T ? T[K] : never + +/** + * Safely test whether or not the first given types extends the second. + * + * Needed in particular for testing if a type is "never". + */ +type Is = [T1] extends [T2] ? true : false + +/** + * Safely test whether or not the given type is "never". + */ +type IsNever = Is + +/** + * Is the given type undefined or never? + */ +type IsUndefinedOrNever = Is + +/** + * Returns whether or not the give two types are the same. + */ +type IsSame = Is extends true ? Is : false + +/** + * Returns whether or not the given type an object (arrays are objects). + */ +type IsObjectOrArray = And>, T extends object ? true : false> + +/** + * Returns whether or not the given type a non-array object. + */ +type IsObject = And, Not>> + +/** + * Returns whether or not the given type an array. + */ +type IsArray = And>, T extends ReadonlyArray ? true : false> + +/** + * And operator for types. + */ +type And = T1 extends false ? false : T2 + +/** + * Or operator for types. + */ +type Or = T1 extends true ? true : T2 + +/** + * Not operator for types. + */ +type Not = T extends true ? false : true + +/** + * A property that can index an object. + */ +export type Property = string | number | symbol diff --git a/src/utils.ts b/src/utils.ts index c3a2dd9..0c49a1a 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,16 +1,18 @@ import { deepmergeImpl } from './deepmerge' +import type { FullOptions, ObjectMerge } from "./options" +import type { Property } from "./types" -function emptyTarget(value) { +export function emptyTarget(value: unknown) { return Array.isArray(value) ? [] : {} } -export function cloneUnlessOtherwiseSpecified(value, options) { +export function cloneUnlessOtherwiseSpecified(value: T, options: FullOptions): T { return (options.clone && options.isMergeable(value)) - ? deepmergeImpl(emptyTarget(value), value, options) + ? deepmergeImpl(emptyTarget(value), value, options) as T : value } -function getEnumerableOwnPropertySymbols(target) { +function getEnumerableOwnPropertySymbols(target: object) { return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter((symbol) => Object.prototype.propertyIsEnumerable.call(target, symbol), @@ -18,11 +20,15 @@ function getEnumerableOwnPropertySymbols(target) { : [] } -export function getKeys(target) { - return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +export function getKeys(target: object) { + // Symbols cannot be used to index objects yet. + // So cast to an array of strings for simplicity. + // @see https://github.com/microsoft/TypeScript/issues/1863 + // TODO: Remove cast once symbols indexing of objects is supported. + return [ ...Object.keys(target), ...getEnumerableOwnPropertySymbols(target) ] as Array } -export function propertyIsOnObject(object, property) { +export function propertyIsOnObject(object: object, property: Property) { try { return property in object } catch { @@ -30,7 +36,10 @@ export function propertyIsOnObject(object, property) { } } -export function getMergeFunction(key, options) { +export function getMergeFunction( + key: Property, + options: FullOptions, +): NonNullable> { if (!options.customMerge) { return deepmergeImpl } @@ -40,7 +49,7 @@ export function getMergeFunction(key, options) { } // Protects from prototype poisoning and unexpected merging up the prototype chain. -export function propertyIsUnsafe(target, key) { +export function propertyIsUnsafe(target: object, key: Property) { return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. diff --git a/tsconfig.typedef.json b/tsconfig.typedef.json new file mode 100644 index 0000000..71cffa1 --- /dev/null +++ b/tsconfig.typedef.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "declaration": true, + "declarationDir": "types/current/", + "emitDeclarationOnly": true + }, + "include": ["./src"] +} From 2e50315579672e3b7b7c9a89f613e34904b07d56 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sat, 23 Jan 2021 04:19:18 +1300 Subject: [PATCH 11/22] test: typescript types --- package-lock.json | 1579 ++++++++++++++++++++++++++++++++++++++ package.json | 2 + src/deepmerge.ts | 2 +- test/tsconfig.json | 12 + test/types/index.d.ts | 1 + test/types/test.ts | 177 +++++ test/types/tsconfig.json | 20 + 7 files changed, 1792 insertions(+), 1 deletion(-) create mode 100644 test/tsconfig.json create mode 100644 test/types/index.d.ts create mode 100644 test/types/test.ts create mode 100644 test/types/tsconfig.json diff --git a/package-lock.json b/package-lock.json index 75bae1f..9b56b7b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,58 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@definitelytyped/header-parser": { + "version": "0.0.66", + "resolved": "https://registry.npmjs.org/@definitelytyped/header-parser/-/header-parser-0.0.66.tgz", + "integrity": "sha512-7OW3yyZETfOrbseU2WhiFD9XEue5I/iAgXe9FG4rs1USD2rmB+RVxTLQVJ4kmtgGy+QrR6fJS1/cs8LgGaZh6Q==", + "dev": true, + "requires": { + "@definitelytyped/typescript-versions": "^0.0.66", + "@types/parsimmon": "^1.10.1", + "parsimmon": "^1.13.0" + } + }, + "@definitelytyped/typescript-versions": { + "version": "0.0.66", + "resolved": "https://registry.npmjs.org/@definitelytyped/typescript-versions/-/typescript-versions-0.0.66.tgz", + "integrity": "sha512-zm6ypaRWaps+734OlgbtNUdl2VlbDg+lgm1ZiiVZu7QpuCcCMfiyanJL0uQESPaoh2VkbHQbRP6gDugFpMKh6g==", + "dev": true + }, + "@definitelytyped/utils": { + "version": "0.0.66", + "resolved": "https://registry.npmjs.org/@definitelytyped/utils/-/utils-0.0.66.tgz", + "integrity": "sha512-J5/SNb0cISss1DIso7++ngzZ5EYdnosvjUgyHueQGRhnoV/jdLqtIlI4RDsk08CkeAG7V9PyIz0fA715DvogCw==", + "dev": true, + "requires": { + "@definitelytyped/typescript-versions": "^0.0.66", + "@types/node": "^12.12.29", + "charm": "^1.0.2", + "fs-extra": "^8.1.0", + "fstream": "^1.0.12", + "npm-registry-client": "^8.6.0", + "tar": "^2.2.2", + "tar-stream": "^2.1.4" + }, + "dependencies": { + "@types/node": { + "version": "12.19.15", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.15.tgz", + "integrity": "sha512-lowukE3GUI+VSYSu6VcBXl14d61Rp5hA1D+61r16qnwC0lYNSqdxcvRh0pswejorHfS+HgwBasM8jLXz0/aOsw==", + "dev": true + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + } + } + }, "@rollup/plugin-commonjs": { "version": "16.0.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-16.0.0.tgz", @@ -145,18 +197,99 @@ "integrity": "sha512-kaYyLYf6ICn6/isAyD4K1MyWWd5Q3JgH6bnMN089LUx88+s4W8GvK9Q6JMBVu5vsFFp7pMdSxdKmlBXwH/VFRg==", "dev": true }, + "@types/parsimmon": { + "version": "1.10.6", + "resolved": "https://registry.npmjs.org/@types/parsimmon/-/parsimmon-1.10.6.tgz", + "integrity": "sha512-FwAQwMRbkhx0J6YELkwIpciVzCcgEqXEbIrIn3a2P5d3kGEHQ3wVhlN3YdVepYP+bZzCYO6OjmD4o9TGOZ40rA==", + "dev": true + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", "dev": true }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, "array-filter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", "dev": true }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, "available-typed-arrays": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz", @@ -166,12 +299,104 @@ "array-filter": "^1.0.0" } }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + } + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bl": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz", + "integrity": "sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==", + "dev": true, + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "dev": true, + "requires": { + "inherits": "~2.0.0" + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -182,6 +407,16 @@ "concat-map": "0.0.1" } }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -194,6 +429,12 @@ "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", "dev": true }, + "builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", + "dev": true + }, "call-bind": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz", @@ -204,6 +445,155 @@ "get-intrinsic": "^1.0.0" } }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "charm": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/charm/-/charm-1.0.2.tgz", + "integrity": "sha1-it02cVOm2aWBMxBSxAkJkdqZXjU=", + "dev": true, + "requires": { + "inherits": "^2.0.1" + } + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true, + "optional": true + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", + "dev": true + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -222,6 +612,46 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "dev": true, + "optional": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, "deep-equal": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.0.4.tgz", @@ -271,6 +701,19 @@ "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", "dev": true }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true, + "optional": true + }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -286,6 +729,79 @@ "minimatch": "^3.0.4" } }, + "dts-critic": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/dts-critic/-/dts-critic-3.3.4.tgz", + "integrity": "sha512-OjLTrSBCFbi1tDAiOXcP7G20W3HI3eIzkpSpLwvH7oDFZYdqFCMe9lsNhMZFXqsNcSTpRg3+PBS4fF27+h1qew==", + "dev": true, + "requires": { + "@definitelytyped/header-parser": "^0.0.66", + "command-exists": "^1.2.8", + "rimraf": "^3.0.2", + "semver": "^6.2.0", + "tmp": "^0.2.1", + "yargs": "^15.3.1" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "dtslint": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/dtslint/-/dtslint-4.0.6.tgz", + "integrity": "sha512-bj5EaTeAqVXDHo/ut8oTRN/hZNTVKTAsNkavyH/T7XeDU/bqrctlYJmQo2HWJzPDoNCjq6NdVgvOnmQBGmSHsg==", + "dev": true, + "requires": { + "@definitelytyped/header-parser": "^0.0.66", + "@definitelytyped/typescript-versions": "^0.0.66", + "@definitelytyped/utils": "^0.0.66", + "dts-critic": "^3.3.4", + "fs-extra": "^6.0.1", + "json-stable-stringify": "^1.0.1", + "strip-json-comments": "^2.0.1", + "tslint": "5.14.0", + "yargs": "^15.1.0" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, "es-abstract": { "version": "1.18.0-next.1", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", @@ -333,6 +849,12 @@ "is-symbol": "^1.0.2" } }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, "escodegen": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.12.0.tgz", @@ -372,12 +894,46 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, "for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -393,6 +949,40 @@ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", "dev": true }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true + }, + "fs-extra": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", + "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -406,12 +996,47 @@ "dev": true, "optional": true }, + "fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, "get-intrinsic": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.1.tgz", @@ -423,6 +1048,15 @@ "has-symbols": "^1.0.1" } }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -437,6 +1071,28 @@ "path-is-absolute": "^1.0.0" } }, + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "dev": true, + "requires": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -446,12 +1102,57 @@ "function-bind": "^1.1.1" } }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, "has-symbols": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", "dev": true }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true, + "optional": true + }, + "hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "dev": true + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -507,6 +1208,16 @@ "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", "dev": true }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "optional": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, "is-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.1.tgz", @@ -606,6 +1317,12 @@ } } }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, "is-weakmap": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", @@ -624,6 +1341,42 @@ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", "dev": true }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "dependencies": { + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + } + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, "jsmd": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/jsmd/-/jsmd-1.0.2.tgz", @@ -637,6 +1390,60 @@ "v8-argv": "github:jkroso/v8-argv#1.1.1" } }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "~0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", @@ -647,6 +1454,15 @@ "type-check": "~0.3.2" } }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -659,6 +1475,21 @@ "integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==", "dev": true }, + "mime-db": { + "version": "1.45.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz", + "integrity": "sha512-CkqLUxUk15hofLoLyljJSrukZi8mAtgd+yE5uO4tqRZsdsAJKv0O+rFMhVDRJgozy+yG6md5KwuXhD4ocIoP+w==", + "dev": true + }, + "mime-types": { + "version": "2.1.28", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.28.tgz", + "integrity": "sha512-0TO2yJ5YHYr7M2zzT7gDU1tbwHxEUWBCLt0lscSNpcdAfFyJOVEpRYNS7EXVcTLNj/25QO8gulHC5JtTzSE2UQ==", + "dev": true, + "requires": { + "mime-db": "1.45.0" + } + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -668,6 +1499,98 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "npm-package-arg": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", + "dev": true, + "requires": { + "hosted-git-info": "^2.7.1", + "osenv": "^0.1.5", + "semver": "^5.6.0", + "validate-npm-package-name": "^3.0.0" + } + }, + "npm-registry-client": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-8.6.0.tgz", + "integrity": "sha512-Qs6P6nnopig+Y8gbzpeN/dkt+n7IyVd8f45NTMotGk6Qo7GfBmzwYx6jRLoOOgKiMnaQfYxsuyQlD8Mc3guBhg==", + "dev": true, + "requires": { + "concat-stream": "^1.5.2", + "graceful-fs": "^4.1.6", + "normalize-package-data": "~1.0.1 || ^2.0.0", + "npm-package-arg": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0", + "npmlog": "2 || ^3.1.0 || ^4.0.0", + "once": "^1.3.3", + "request": "^2.74.0", + "retry": "^0.10.0", + "safe-buffer": "^5.1.1", + "semver": "2 >=2.2.1 || 3.x || 4 || 5", + "slide": "^1.1.3", + "ssri": "^5.2.4" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true, + "optional": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true, + "optional": true + }, "object-inspect": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", @@ -725,6 +1648,64 @@ "wordwrap": "~1.0.0" } }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "parsimmon": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.16.0.tgz", + "integrity": "sha512-tekGDz2Lny27SQ/5DzJdIK0lqsWwZ667SCLFIDCxaZM7VNgQjyKLbaL7FYPKpbjdxNAXFV/mSxkq5D2fnkW4pA==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -737,6 +1718,12 @@ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", @@ -749,6 +1736,59 @@ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "dev": true + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + } + } + }, "regexp.prototype.flags": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz", @@ -780,6 +1820,46 @@ } } }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, "resolve": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", @@ -799,6 +1879,21 @@ "through": "~2.3.4" } }, + "retry": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", + "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "rollup": { "version": "2.33.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.33.1.tgz", @@ -808,6 +1903,30 @@ "fsevents": "~2.1.2" } }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, "side-channel": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.3.tgz", @@ -818,6 +1937,19 @@ "object-inspect": "^1.8.0" } }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true, + "optional": true + }, + "slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -840,6 +1972,82 @@ "integrity": "sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg==", "dev": true }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==", + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "ssri": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", + "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "optional": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, "string.prototype.trim": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.2.tgz", @@ -870,6 +2078,44 @@ "es-abstract": "^1.18.0-next.1" } }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, "tape": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/tape/-/tape-5.0.1.tgz", @@ -903,6 +2149,43 @@ } } }, + "tar": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", + "dev": true, + "requires": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + } + }, + "tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "terser": { "version": "5.5.1", "resolved": "https://registry.npmjs.org/terser/-/terser-5.5.1.tgz", @@ -928,6 +2211,36 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, + "tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, + "requires": { + "rimraf": "^3.0.0" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, "ts-node": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", @@ -947,6 +2260,79 @@ "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", "dev": true }, + "tslint": { + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.14.0.tgz", + "integrity": "sha512-IUla/ieHVnB8Le7LdQFRGlVJid2T/gaJe5VkjzRVSRR6pA2ODYrnfR1hmxi+5+au9l50jBwpbBL34txgv4NnTQ==", + "dev": true, + "requires": { + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + }, + "dependencies": { + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + } + } + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + } + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -956,17 +2342,80 @@ "prelude-ls": "~1.1.2" } }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, "typescript": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.2.tgz", "integrity": "sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==", "dev": true }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + }, "v8-argv": { "version": "github:jkroso/v8-argv#284f84379e292eb956a5e7b66fb953ec4974385e", "from": "github:jkroso/v8-argv#1.1.1", "dev": true }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", + "dev": true, + "requires": { + "builtins": "^1.0.3" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, "which-boxed-primitive": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.1.tgz", @@ -992,6 +2441,12 @@ "is-weakset": "^2.0.1" } }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, "which-typed-array": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.2.tgz", @@ -1027,18 +2482,142 @@ } } }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", "dev": true }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "y18n": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", + "dev": true + }, + "yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", diff --git a/package.json b/package.json index 4ef2e48..698667d 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "build:types": "tsc -p tsconfig.typedef.json", "size": "npm run build && terser --compress --mangle -- ./dist/umd.js | gzip -c | wc -c", "test": "npm run build && tape test/*.js && jsmd readme.md && npm run test:typescript", + "test:types": "dtslint --localTs node_modules/typescript/lib --expectOnly test/types", "test:typescript": "tsc --noEmit test/typescript.ts && ts-node test/typescript.ts" }, "dependencies": {}, @@ -40,6 +41,7 @@ "@rollup/plugin-node-resolve": "^10.0.0", "@rollup/plugin-typescript": "^8.1.0", "@types/node": "^8.10.54", + "dtslint": "^4.0.6", "is-mergeable-object": "1.1.0", "is-plain-obj": "^3.0.0", "jsmd": "^1.0.2", diff --git a/src/deepmerge.ts b/src/deepmerge.ts index 4e164ae..7f744db 100644 --- a/src/deepmerge.ts +++ b/src/deepmerge.ts @@ -117,5 +117,5 @@ export function deepmergeAll(objects: ReadonlyArray, options?: Options): : value } - return objects.reduce((prev, next) => deepmergeImpl(prev, next, fullOptions), {}) + return objects.reduce((prev, next) => deepmergeImpl(prev, next, fullOptions)) } diff --git a/test/tsconfig.json b/test/tsconfig.json new file mode 100644 index 0000000..ae24586 --- /dev/null +++ b/test/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "baseUrl": "../", + "paths": { + "deepmerge": [ + "src/" + ] + } + } +} diff --git a/test/types/index.d.ts b/test/types/index.d.ts new file mode 100644 index 0000000..e560b87 --- /dev/null +++ b/test/types/index.d.ts @@ -0,0 +1 @@ +// Minimum TypeScript Version: 4.1 diff --git a/test/types/test.ts b/test/types/test.ts new file mode 100644 index 0000000..e1991ec --- /dev/null +++ b/test/types/test.ts @@ -0,0 +1,177 @@ +import type { Options } from "deepmerge" +import { deepmerge, deepmergeAll } from "deepmerge" + +const a = { + foo: `abc`, + baz: { + quuz: [ `def`, `ghi` ], + }, + garply: 42, +} + +const b = { + foo: `cba`, + baz: { + corge: 96, + }, + grault: 42, +} + +// $ExpectType { foo: string; baz: { quuz: string[]; corge: number; }; garply: number; grault: number; } +deepmerge(a, b) +// $ExpectType { foo: string; baz: { quuz: string[]; corge: number; }; garply: number; grault: number; } +deepmergeAll([ a, b ]) + +type T = { + readonly foo: string; + bar?: string; +} + +// TODO: Should the result really be `T`? or should it be `DeepMutable`? +// $ExpectType T +deepmerge(a as T, b as T) +// $ExpectType T +deepmergeAll([ a as T, b as T ]) + +type U = { + bar?: string; +} + +// $ExpectType { foo: string; bar?: string | undefined; } +deepmerge(a as T, b as U) +// $ExpectType { foo: string; bar?: string | undefined; } +deepmergeAll([ a as T, b as U ]) + +const c = { + bar: `123`, + quux: `456`, + garply: 42, +} as const + +// $ExpectType { foo: string; baz: { quuz: string[]; }; garply: 42; bar: "123"; quux: "456"; } +deepmerge(a, c) +// $ExpectType { foo: string; baz: { quuz: string[]; }; garply: 42; bar: "123"; quux: "456"; } +deepmergeAll([ a, c ]) + +// $ExpectType { foo: string; baz: { corge: number; }; grault: number; bar: "123"; quux: "456"; garply: 42; } +deepmerge(b, c) +// $ExpectType { foo: string; baz: { corge: number; }; grault: number; bar: "123"; quux: "456"; garply: 42; } +deepmergeAll([ b, c ]) + +// $ExpectType { foo: string; baz: { quuz: string[]; corge: number; }; garply: 42; grault: number; bar: "123"; quux: "456"; } +deepmergeAll([ a, b, c ]) + +// Allow arbitrary arrays of objects to be passes even if we can't determine anything about the result. +const abc = [ a, b, c ] +// $ExpectType object +deepmergeAll(abc) + +const d = { + bar: `abc`, + quux: `def`, + garply: 5, +} as const + +// $ExpectType { bar: "abc"; quux: "def"; garply: 5; } +deepmerge(c, d) +// $ExpectType { bar: "abc"; quux: "def"; garply: 5; } +deepmergeAll([ c, d ]) + +type E = { readonly foo: ReadonlyArray }; +type F = { readonly foo: ReadonlyArray }; + +const e = { + foo: [ 1, 2, 3 ], +} as const + +const f = { + foo: [ `a`, `b`, `c` ], +} as const + +// $ExpectType { foo: [1, 2, 3, "a", "b", "c"]; } +deepmerge(e, f) +// $ExpectType { foo: [1, 2, 3, "a", "b", "c"]; } +deepmergeAll([ e, f ]) + +// $ExpectType { foo: (string | number)[]; } +deepmerge(e as E, f as F) +// $ExpectType { foo: (string | number)[]; } +deepmergeAll([ e as E, f as F ]) + +const g = { + key1: `key1-val`, + key2: { + key2key1: [ false, `true` ], + }, + key3: { + key3key1: { + key3key1key1: `key3key1key1-val`, + key3key1key2: true, + key3key1key3: [ `key3key1key3-val` ], + }, + key3key2: [ `key3key2-val` ], + }, +} + +const h = { + key1: [ `key1-val` ], + key2: { + key2key1: { + key2key1key1: () => `key2key1key1-val`, + key2key1key2: true, + key2key1key3: [ `key2key1key3-val` ], + }, + }, + key3: { + key3key1: () => false, + key3key2: [ `key3key2-val`, true ], + }, +} + +// $ExpectType { key1: string[]; key2: { key2key1: { key2key1key1: () => string; key2key1key2: boolean; key2key1key3: string[]; }; }; key3: { key3key1: { key3key1key1: string; key3key1key2: boolean; key3key1key3: string[]; }; key3key2: (string | boolean)[]; }; } +deepmerge(g, h) +// $ExpectType { key1: string[]; key2: { key2key1: { key2key1key1: () => string; key2key1key2: boolean; key2key1key3: string[]; }; }; key3: { key3key1: { key3key1key1: string; key3key1key2: boolean; key3key1key3: string[]; }; key3key2: (string | boolean)[]; }; } +deepmergeAll([ g, h ]) + +// $ExpectType { foo: string; baz: unknown; garply: number; grault: number; } +deepmerge(a, b, { + isMergeable: (obj: object) => false, +}) +// $ExpectType { foo: string; baz: unknown; garply: number; grault: number; } +deepmergeAll([ a, b ], { + isMergeable: (obj: object) => false, +}) + +const i = { + baz: { + quuz: [ 5, 6 ], + }, +} + +// $ExpectType { foo: string; baz: { quuz: number; }; garply: number; } +deepmerge(a, i, { + arrayMerge: (target: Array, source: Array) => + target.length + source.length, +}) +// $ExpectType { foo: string; baz: { quuz: number; }; garply: number; } +deepmergeAll([ a, i ], { + arrayMerge: (target: Array, source: Array) => + target.length + source.length, +}) + +// $ExpectType { foo: string; baz: { quuz: (string | number)[]; }; garply: number; } +deepmerge(a, i, { + customMerge: ((key) => { + if (key === `bar`) { + return (target: string, source: string) => target + source + } + }) as Options['customMerge'], +}) +// $ExpectType { foo: string; baz: { quuz: (string | number)[]; }; garply: number; } +deepmergeAll([ a, i ], { + customMerge: ((key) => { + if (key === `bar`) { + return (target: string, source: string) => target + source + } + }) as Options['customMerge'], +}) diff --git a/test/types/tsconfig.json b/test/types/tsconfig.json new file mode 100644 index 0000000..dc3459a --- /dev/null +++ b/test/types/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + "lib": [ + "ESNext" + ], + "noEmit": true, + "strict": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "alwaysStrict": true, + "baseUrl": "../../", + "paths": { + "deepmerge": [ + "src/" + ] + } + } +} From 7b9b5b50da82a75cd80ff1a65da87a7997eabe91 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sat, 23 Jan 2021 04:45:59 +1300 Subject: [PATCH 12/22] fix: add legacy types for older version of typescript --- package.json | 14 +++++++++++++- types/legacy/index.d.ts | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 types/legacy/index.d.ts diff --git a/package.json b/package.json index 698667d..c371772 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,19 @@ }, "license": "MIT", "main": "dist/cjs.js", - "types": "types/current/index.d.ts", + "types": "types/legacy/index.d.ts", + "typesVersions": { + "<4.1": { + "*": [ + "types/legacy/index.d.ts" + ] + }, + ">=4.1": { + "*": [ + "types/current/*" + ] + } + }, "files": [ "dist/", "types/", diff --git a/types/legacy/index.d.ts b/types/legacy/index.d.ts new file mode 100644 index 0000000..22c41df --- /dev/null +++ b/types/legacy/index.d.ts @@ -0,0 +1,37 @@ +/** + * @file + * + * These types are a more simplified version of this library's types + * designed to work with versions of TypeScript < 4.1 + */ + +/** + * Deeply merge two objects. + * + * @param target The first object. + * @param source The second object. + * @param options Deep merge options. + */ +export default function deepmerge(target: T1, source: T2, options?: Options): T1 & T2; + +/** + * Deeply merge two or more objects. + * + * @param objects An tuple of the objects to merge. + * @param options Deep merge options. + */ +export function deepmergeAll(objects: [T1, T2], options?: Options): T1 & T2; +export function deepmergeAll(objects: [T1, T2, T3], options?: Options): T1 & T2 & T3; +export function deepmergeAll(objects: [T1, T2, T3, T4], options?: Options): T1 & T2 & T3 & T4; +export function deepmergeAll(objects: [T1, T2, T3, T4, T5], options?: Options): T1 & T2 & T3 & T4 & T5; +export function deepmergeAll(objects: ReadonlyArray, options?: Options): T; + +/** + * Deep merge options. + */ +export type Options = { + arrayMerge?: (target: object[], source: object[], options: Options) => any; + clone?: boolean; + customMerge?: (key: string) => ((target: object, source: object, options: Options) => any) | undefined; + isMergeable?: (value: object) => boolean; +} From 0538453565ebd428ed6c4c53002930adb70b31a8 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sat, 23 Jan 2021 21:25:03 +1300 Subject: [PATCH 13/22] test: initial conversion of test to typescript --- package-lock.json | 42 ++++++++++++ package.json | 10 ++- ...m-array-merge.js => custom-array-merge.ts} | 4 +- ...bject.js => custom-is-mergeable-object.ts} | 4 +- test/{merge-all.js => merge-all.ts} | 4 +- ...lain-objects.js => merge-plain-objects.ts} | 68 +++++++++---------- test/{merge.js => merge.ts} | 4 +- ...pe-poisoning.js => prototype-poisoning.ts} | 8 +-- test/typescript.ts | 65 ------------------ 9 files changed, 95 insertions(+), 114 deletions(-) rename test/{custom-array-merge.js => custom-array-merge.ts} (95%) rename test/{custom-is-mergeable-object.js => custom-is-mergeable-object.ts} (93%) rename test/{merge-all.js => merge-all.ts} (97%) rename test/{merge-plain-objects.js => merge-plain-objects.ts} (88%) rename test/{merge.js => merge.ts} (99%) rename test/{prototype-poisoning.js => prototype-poisoning.ts} (91%) delete mode 100644 test/typescript.ts diff --git a/package-lock.json b/package-lock.json index 9b56b7b..a7a89eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -191,6 +191,12 @@ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", "dev": true }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, "@types/node": { "version": "8.10.54", "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.54.tgz", @@ -203,6 +209,15 @@ "integrity": "sha512-FwAQwMRbkhx0J6YELkwIpciVzCcgEqXEbIrIn3a2P5d3kGEHQ3wVhlN3YdVepYP+bZzCYO6OjmD4o9TGOZ40rA==", "dev": true }, + "@types/tape": { + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@types/tape/-/tape-4.13.0.tgz", + "integrity": "sha512-0V8cKowBdsiA9nbxAg7531sF2cdPZNiUogcfIUeUGm+bejUBE/bvibz3rH36iQP9bQjO/sOzFwU97/uC5mCyoA==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1417,6 +1432,15 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -2104,6 +2128,12 @@ "ansi-regex": "^2.0.0" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, "strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", @@ -2254,6 +2284,18 @@ "yn": "3.1.1" } }, + "tsconfig-paths": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", + "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + } + }, "tslib": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", diff --git a/package.json b/package.json index c371772..21dba37 100644 --- a/package.json +++ b/package.json @@ -43,9 +43,11 @@ "build:js": "rollup -c", "build:types": "tsc -p tsconfig.typedef.json", "size": "npm run build && terser --compress --mangle -- ./dist/umd.js | gzip -c | wc -c", - "test": "npm run build && tape test/*.js && jsmd readme.md && npm run test:typescript", - "test:types": "dtslint --localTs node_modules/typescript/lib --expectOnly test/types", - "test:typescript": "tsc --noEmit test/typescript.ts && ts-node test/typescript.ts" + "test": "npm run test:js && npm run test:types && npm run test:jsmd", + "test:js": "ts-node -C typescript -P test/tsconfig.json -r tsconfig-paths/register node_modules/tape/bin/tape test/*.ts", + "pretest:jsmd": "npm run build:js", + "test:jsmd": "jsmd readme.md", + "test:types": "dtslint --localTs node_modules/typescript/lib --expectOnly test/types" }, "dependencies": {}, "devDependencies": { @@ -53,6 +55,7 @@ "@rollup/plugin-node-resolve": "^10.0.0", "@rollup/plugin-typescript": "^8.1.0", "@types/node": "^8.10.54", + "@types/tape": "^4.13.0", "dtslint": "^4.0.6", "is-mergeable-object": "1.1.0", "is-plain-obj": "^3.0.0", @@ -61,6 +64,7 @@ "tape": "^5.0.1", "terser": "^5.5.1", "ts-node": "^9.0.0", + "tsconfig-paths": "^3.9.0", "tslib": "^2.1.0", "typescript": "^4.1.2" }, diff --git a/test/custom-array-merge.js b/test/custom-array-merge.ts similarity index 95% rename from test/custom-array-merge.js rename to test/custom-array-merge.ts index 0a81100..78147cd 100644 --- a/test/custom-array-merge.js +++ b/test/custom-array-merge.ts @@ -1,5 +1,5 @@ -var merge = require('../') -var test = require('tape') +import { deepmerge as merge } from "deepmerge" +import test from "tape" test('custom merge array', function(t) { var mergeFunctionCalled = false diff --git a/test/custom-is-mergeable-object.js b/test/custom-is-mergeable-object.ts similarity index 93% rename from test/custom-is-mergeable-object.js rename to test/custom-is-mergeable-object.ts index b3654f4..b84edba 100644 --- a/test/custom-is-mergeable-object.js +++ b/test/custom-is-mergeable-object.ts @@ -1,5 +1,5 @@ -var merge = require('../') -var test = require('tape') +import { deepmerge as merge } from "deepmerge" +import test from "tape" test('isMergeable function copying object over object', function(t) { var src = { key: { isMergeable: false }, baz: 'yes' } diff --git a/test/merge-all.js b/test/merge-all.ts similarity index 97% rename from test/merge-all.js rename to test/merge-all.ts index 4627e77..4177404 100644 --- a/test/merge-all.js +++ b/test/merge-all.ts @@ -1,5 +1,5 @@ -var merge = require('../') -var test = require('tape') +import { deepmerge as merge } from "deepmerge" +import test from "tape" test('throw error if first argument is not an array', function(t) { t.throws(merge.all.bind(null, { example: true }, { another: '2' }), Error) diff --git a/test/merge-plain-objects.js b/test/merge-plain-objects.ts similarity index 88% rename from test/merge-plain-objects.js rename to test/merge-plain-objects.ts index a112a81..7722f87 100644 --- a/test/merge-plain-objects.js +++ b/test/merge-plain-objects.ts @@ -1,34 +1,34 @@ -var merge = require('../') -var test = require('tape') - -test('plain objects are merged by default', function(t) { - const input = { - newObject: new Object(), - objectLiteral: { a: 123 } - } - const output = merge({}, input) - - t.deepEqual(output.newObject, input.newObject) - t.notEqual(output.newObject, input.newObject) - t.deepEqual(output.objectLiteral, input.objectLiteral) - t.notEqual(output.objectLiteral, input.objectLiteral) - - t.end() -}) - -test('instantiated objects are copied by reference', function(t) { - const input = { - date: new Date(), - error: new Error(), - regex: /regex/ - } - const output = merge({}, input) - - t.equal(output.date, input.date) - t.equal(output.error, input.error) - t.equal(output.regex, input.regex) - - t.end() -}) - - +import { deepmerge as merge } from "deepmerge" +import test from "tape" + +test('plain objects are merged by default', function(t) { + const input = { + newObject: new Object(), + objectLiteral: { a: 123 } + } + const output = merge({}, input) + + t.deepEqual(output.newObject, input.newObject) + t.notEqual(output.newObject, input.newObject) + t.deepEqual(output.objectLiteral, input.objectLiteral) + t.notEqual(output.objectLiteral, input.objectLiteral) + + t.end() +}) + +test('instantiated objects are copied by reference', function(t) { + const input = { + date: new Date(), + error: new Error(), + regex: /regex/ + } + const output = merge({}, input) + + t.equal(output.date, input.date) + t.equal(output.error, input.error) + t.equal(output.regex, input.regex) + + t.end() +}) + + diff --git a/test/merge.js b/test/merge.ts similarity index 99% rename from test/merge.js rename to test/merge.ts index 789d2f8..e4470c4 100644 --- a/test/merge.js +++ b/test/merge.ts @@ -1,5 +1,5 @@ -var merge = require('../') -var test = require('tape') +import { deepmerge as merge } from "deepmerge" +import test from "tape" test('add keys in target that do not exist at the root', function(t) { var src = { key1: 'value1', key2: 'value2' } diff --git a/test/prototype-poisoning.js b/test/prototype-poisoning.ts similarity index 91% rename from test/prototype-poisoning.js rename to test/prototype-poisoning.ts index 744e54c..94f42c0 100644 --- a/test/prototype-poisoning.js +++ b/test/prototype-poisoning.ts @@ -1,6 +1,6 @@ -var merge = require('../') -var test = require('tape') -var isMergeableObject = require('is-mergeable-object') +import { deepmerge as merge } from "deepmerge" +import test from "tape" +import isPlainObj from "is-plain-obj" test('merging objects with own __proto__', function(t) { var user = {} @@ -51,7 +51,7 @@ test('merging strings works with a custom string merge', function(t) { } function mergeable(target) { - return isMergeableObject(target) || (typeof target === 'string' && target.length > 1) + return isPlainObj(target) || (typeof target === 'string' && target.length > 1) } t.equal('A. Ham', merge(target, source, { customMerge: customMerge, isMergeable: mergeable }).name) diff --git a/test/typescript.ts b/test/typescript.ts deleted file mode 100644 index f562095..0000000 --- a/test/typescript.ts +++ /dev/null @@ -1,65 +0,0 @@ -import * as merge from '../'; - -const x = { - foo: 'abc', - bar: 'def', - wat: 42, -} - -const y = { - foo: 'cba', - bar: 'fed', - wat: 42, -} - -const z = { - baz: '123', - quux: '456', - wat: 42, -} - -let merged1 = merge(x, y); -let merged2 = merge(x, z); -let merged3 = merge.all<{wat: number}>([ x, y, z ]); - -merged1.foo; -merged1.bar; -merged2.foo; -merged2.baz; -merged3.wat; - - -const options1: merge.Options = { - clone: true, - isMergeable (obj) { - return false; - }, -}; - -const options2: merge.Options = { - arrayMerge (target, source, options) { - target.length; - source.length; - options.isMergeable(target); - - return []; - }, - clone: true, - isMergeable (obj) { - return false; - }, -}; - -const options3: merge.Options = { - customMerge: (key) => { - if (key === 'foo') { - return (target, source) => target + source; - } - } -} - -merged1 = merge(x, y, options1); -merged2 = merge(x, z, options2); -merged3 = merge.all<{wat: number}>([x, y, z], options1); - -const merged4 = merge(x, y, options3); From 4583214b24288d710a922bca76dba212e43a57da Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sat, 23 Jan 2021 21:46:49 +1300 Subject: [PATCH 14/22] test: get tests working --- readme.md | 6 +++--- test/custom-is-mergeable-object.ts | 4 ++-- test/merge-all.ts | 21 +++++++++++---------- test/merge.ts | 14 +++++++------- test/prototype-poisoning.ts | 2 +- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/readme.md b/readme.md index c315fca..3375fb9 100644 --- a/readme.md +++ b/readme.md @@ -10,7 +10,7 @@ Merges the enumerable properties of two or more objects deeply. ### Example Usage ```js @@ -90,7 +90,7 @@ Merging creates a new object, so that neither `x` or `y` is modified. **Note:** By default, arrays are merged by concatenating them. -## `merge.all(arrayOfObjects, [options])` +## `mergeAll(arrayOfObjects, [options])` Merges any number of objects into a single result object. @@ -99,7 +99,7 @@ const foobar = { foo: { bar: 3 } } const foobaz = { foo: { baz: 4 } } const bar = { bar: 'yay!' } -merge.all([ foobar, foobaz, bar ]) // => { foo: { bar: 3, baz: 4 }, bar: 'yay!' } +mergeAll([ foobar, foobaz, bar ]) // => { foo: { bar: 3, baz: 4 }, bar: 'yay!' } ``` diff --git a/test/custom-is-mergeable-object.ts b/test/custom-is-mergeable-object.ts index b84edba..76903e0 100644 --- a/test/custom-is-mergeable-object.ts +++ b/test/custom-is-mergeable-object.ts @@ -6,7 +6,7 @@ test('isMergeable function copying object over object', function(t) { var target = { key: { foo: 'wat' }, baz: 'whatever' } function customIsMergeable(object) { - return object && typeof value === 'object' && object.isMergeable !== false + return object && typeof object === 'object' && object.isMergeable !== false } var res = merge(target, src, { @@ -23,7 +23,7 @@ test('isMergeable function copying object over nothing', function(t) { var target = { baz: 'whatever' } function customIsMergeable(object) { - return object && typeof value === 'object' && object.isMergeable !== false + return object && typeof object === 'object' && object.isMergeable !== false } var res = merge(target, src, { diff --git a/test/merge-all.ts b/test/merge-all.ts index 4177404..dc392b2 100644 --- a/test/merge-all.ts +++ b/test/merge-all.ts @@ -1,18 +1,19 @@ -import { deepmerge as merge } from "deepmerge" +import { deepmergeAll as mergeAll } from "deepmerge" import test from "tape" test('throw error if first argument is not an array', function(t) { - t.throws(merge.all.bind(null, { example: true }, { another: '2' }), Error) + // @ts-expect-error + t.throws(mergeAll.bind(null, { example: true }, { another: '2' }), Error) t.end() }) test('return an empty object if first argument is an array with no elements', function(t) { - t.deepEqual(merge.all([]), {}) + t.deepEqual(mergeAll([]), {}) t.end() }) test('Work just fine if first argument is an array with least than two elements', function(t) { - var actual = merge.all([{ example: true }]) + var actual = mergeAll([{ example: true }]) var expected = { example: true } t.deepEqual(actual, expected) t.end() @@ -20,13 +21,13 @@ test('Work just fine if first argument is an array with least than two elements' test('execute correctly if options object were not passed', function(t) { var arrayToMerge = [{ example: true }, { another: '123' }] - t.doesNotThrow(merge.all.bind(null, arrayToMerge)) + t.doesNotThrow(mergeAll.bind(null, arrayToMerge)) t.end() }) test('execute correctly if options object were passed', function(t) { var arrayToMerge = [{ example: true }, { another: '123' }] - t.doesNotThrow(merge.all.bind(null, arrayToMerge, { clone: true })) + t.doesNotThrow(mergeAll.bind(null, arrayToMerge, { clone: true })) t.end() }) @@ -36,7 +37,7 @@ test('invoke merge on every item in array should result with all props', functio var thirdObject = { third: 123 } var fourthObject = { fourth: 'some string' } - var mergedObject = merge.all([ firstObject, secondObject, thirdObject, fourthObject ]) + var mergedObject = mergeAll([ firstObject, secondObject, thirdObject, fourthObject ]) t.ok(mergedObject.first === true) t.ok(mergedObject.second === false) @@ -50,7 +51,7 @@ test('invoke merge on every item in array with clone should clone all elements', var secondObject = { b: { e: true } } var thirdObject = { c: { f: 'string' } } - var mergedWithClone = merge.all([ firstObject, secondObject, thirdObject ], { clone: true }) + var mergedWithClone = mergeAll([ firstObject, secondObject, thirdObject ], { clone: true }) t.notEqual(mergedWithClone.a, firstObject.a) t.notEqual(mergedWithClone.b, secondObject.b) @@ -64,7 +65,7 @@ test('invoke merge on every item in array clone=false should not clone all eleme var secondObject = { b: { e: true } } var thirdObject = { c: { f: 'string' } } - var mergedWithoutClone = merge.all([ firstObject, secondObject, thirdObject ], { clone: false }) + var mergedWithoutClone = mergeAll([ firstObject, secondObject, thirdObject ], { clone: false }) t.equal(mergedWithoutClone.a, firstObject.a) t.equal(mergedWithoutClone.b, secondObject.b) @@ -79,7 +80,7 @@ test('invoke merge on every item in array without clone should clone all element var secondObject = { b: { e: true } } var thirdObject = { c: { f: 'string' } } - var mergedWithoutClone = merge.all([ firstObject, secondObject, thirdObject ]) + var mergedWithoutClone = mergeAll([ firstObject, secondObject, thirdObject ]) t.notEqual(mergedWithoutClone.a, firstObject.a) t.notEqual(mergedWithoutClone.b, secondObject.b) diff --git a/test/merge.ts b/test/merge.ts index e4470c4..e46b9a5 100644 --- a/test/merge.ts +++ b/test/merge.ts @@ -1,4 +1,4 @@ -import { deepmerge as merge } from "deepmerge" +import { deepmerge as merge, deepmergeAll as mergeAll } from "deepmerge" import test from "tape" test('add keys in target that do not exist at the root', function(t) { @@ -339,7 +339,7 @@ test('should work on array of objects with clone option', function(t) { t.ok(Array.isArray(merge(target, src)[0].key1), 'subkey should be an array too') t.notEqual(merged[0].key1, src[0].key1) t.notEqual(merged[0].key1, target[0].key1) - t.notEqual(merged[0].key2, src[0].key2) + t.false(Object.prototype.hasOwnProperty.call(merged[0], 'key2'), '"key2" should not exist on "merged[0]"'); t.notEqual(merged[1].key3, src[1].key3) t.notEqual(merged[1].key3, target[1].key3) t.end() @@ -507,7 +507,7 @@ test('should handle custom merge functions', function(t) { } const options = { - customMerge: (key, options) => { + customMerge: (key) => { if (key === 'people') { return mergePeople } @@ -555,7 +555,7 @@ test('should handle custom merge functions', function(t) { const options = { - customMerge: (key, options) => { + customMerge: (key) => { if (key === 'letters') { return mergeLetters } @@ -609,7 +609,7 @@ test('should merge correctly if custom merge is not a valid function', function( } } - var actual = merge(target, source, options) + var actual = merge(target, source) t.deepEqual(actual, expected) t.end() @@ -634,7 +634,7 @@ test('copy symbol keys in target that do exist on the target', function(t) { var res = merge(target, src) - t.equal(res[mySymbol], 'value1') + t.equal(res[mySymbol as unknown as string], 'value1') t.end() }) @@ -698,7 +698,7 @@ test('With clone: false, merge should not clone the target root', t => { test('With clone: false, merge.all should not clone the target root', t => { const destination = {} - const output = merge.all([ + const output = mergeAll([ destination, { sup: true } diff --git a/test/prototype-poisoning.ts b/test/prototype-poisoning.ts index 94f42c0..48308fc 100644 --- a/test/prototype-poisoning.ts +++ b/test/prototype-poisoning.ts @@ -40,7 +40,7 @@ test('merging objects with plain and non-plain properties', function(t) { test('merging strings works with a custom string merge', function(t) { var target = { name: "Alexander" } var source = { name: "Hamilton" } - function customMerge(key, options) { + function customMerge(key) { if (key === 'name') { return function(target, source, options) { return target[0] + '. ' + source.substring(0, 3) From e037872b5e64d681201105c7195e671f8059a17c Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sat, 23 Jan 2021 23:50:17 +1300 Subject: [PATCH 15/22] test: remove duplicate test --- test/merge.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/test/merge.ts b/test/merge.ts index e46b9a5..0d65ece 100644 --- a/test/merge.ts +++ b/test/merge.ts @@ -677,15 +677,6 @@ test('Falsey properties should be mergeable', function(t) { t.end() }) -test('should not mutate options', function(t) { - var options = {} - - merge({}, {}, options) - - t.deepEqual(options, {}) - t.end() -}) - test('With clone: false, merge should not clone the target root', t => { const destination = {} const output = merge(destination, { From 1e84f1a2f67971314f9057db7635703aeca4e324 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sat, 23 Jan 2021 23:51:36 +1300 Subject: [PATCH 16/22] test: move mergeAll test to merge-all test file --- test/merge-all.ts | 12 ++++++++++++ test/merge.ts | 13 +------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/test/merge-all.ts b/test/merge-all.ts index dc392b2..03f1074 100644 --- a/test/merge-all.ts +++ b/test/merge-all.ts @@ -88,3 +88,15 @@ test('invoke merge on every item in array without clone should clone all element t.end() }) + +test('With clone: false, mergeAll should not clone the target root', t => { + const destination = {} + const output = mergeAll([ + destination, { + sup: true + } + ], { clone: false }) + + t.equal(destination, output) + t.end() +}) diff --git a/test/merge.ts b/test/merge.ts index 0d65ece..3d2be9d 100644 --- a/test/merge.ts +++ b/test/merge.ts @@ -1,4 +1,4 @@ -import { deepmerge as merge, deepmergeAll as mergeAll } from "deepmerge" +import { deepmerge as merge } from "deepmerge" import test from "tape" test('add keys in target that do not exist at the root', function(t) { @@ -687,14 +687,3 @@ test('With clone: false, merge should not clone the target root', t => { t.end() }) -test('With clone: false, merge.all should not clone the target root', t => { - const destination = {} - const output = mergeAll([ - destination, { - sup: true - } - ], { clone: false }) - - t.equal(destination, output) - t.end() -}) From 7c537a154e32b71327bde25b40a9d9100faa7227 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sat, 23 Jan 2021 23:12:55 +1300 Subject: [PATCH 17/22] test: upgrade and fix test code --- test/custom-array-merge.ts | 53 +-- test/custom-is-mergeable-object.ts | 39 +- test/merge-all.ts | 72 +-- test/merge-plain-objects.ts | 8 +- test/merge.ts | 694 ++++++++++++++--------------- test/prototype-poisoning.ts | 90 ++-- 6 files changed, 473 insertions(+), 483 deletions(-) diff --git a/test/custom-array-merge.ts b/test/custom-array-merge.ts index 78147cd..29084d0 100644 --- a/test/custom-array-merge.ts +++ b/test/custom-array-merge.ts @@ -1,17 +1,20 @@ +import type { Options } from "deepmerge" import { deepmerge as merge } from "deepmerge" import test from "tape" -test('custom merge array', function(t) { - var mergeFunctionCalled = false - function overwriteMerge(target, source, options) { +test(`custom merge array`, (t) => { + let mergeFunctionCalled = false + + const overwriteMerge: Options[`arrayMerge`] = (target, source, options) => { mergeFunctionCalled = true t.equal(options.arrayMerge, overwriteMerge) return source } + const destination = { someArray: [ 1, 2 ], - someObject: { what: 'yes' }, + someObject: { what: `yes` }, } const source = { someArray: [ 1, 2, 3 ], @@ -20,7 +23,7 @@ test('custom merge array', function(t) { const actual = merge(destination, source, { arrayMerge: overwriteMerge }) const expected = { someArray: [ 1, 2, 3 ], - someObject: { what: 'yes' }, + someObject: { what: `yes` }, } t.ok(mergeFunctionCalled) @@ -28,38 +31,36 @@ test('custom merge array', function(t) { t.end() }) -test('merge top-level arrays', function(t) { - function overwriteMerge(a, b) { - return b - } - var actual = merge([ 1, 2 ], [ 1, 2 ], { arrayMerge: overwriteMerge }) - var expected = [ 1, 2 ] +test(`merge top-level arrays`, (t) => { + const overwriteMerge: Options[`arrayMerge`] = (a, b) => b + + const actual = merge([ 1, 2 ], [ 1, 2 ], { arrayMerge: overwriteMerge }) + const expected = [ 1, 2 ] t.deepEqual(actual, expected) t.end() }) -test('cloner function is available for merge functions to use', function(t) { - var customMergeWasCalled = false - function cloneMerge(target, source, options) { +test(`cloner function is available for merge functions to use`, (t) => { + let customMergeWasCalled = false + + const cloneMerge: Options[`arrayMerge`] = (target, source, options) => { customMergeWasCalled = true - t.ok(options.cloneUnlessOtherwiseSpecified, 'cloner function is available') - return target.concat(source).map(function(element) { - return options.cloneUnlessOtherwiseSpecified(element, options) - }) + t.ok(options.cloneUnlessOtherwiseSpecified, `cloner function is available`) + return [ ...target, ...source ].map((element) => options.cloneUnlessOtherwiseSpecified(element, options)) } - var src = { - key1: [ 'one', 'three' ], - key2: [ 'four' ], + const src = { + key1: [ `one`, `three` ], + key2: [ `four` ], } - var target = { - key1: [ 'one', 'two' ], + const target = { + key1: [ `one`, `two` ], } - var expected = { - key1: [ 'one', 'two', 'one', 'three' ], - key2: [ 'four' ], + const expected = { + key1: [ `one`, `two`, `one`, `three` ], + key2: [ `four` ], } t.deepEqual(merge(target, src, { arrayMerge: cloneMerge }), expected) diff --git a/test/custom-is-mergeable-object.ts b/test/custom-is-mergeable-object.ts index 76903e0..d76f628 100644 --- a/test/custom-is-mergeable-object.ts +++ b/test/custom-is-mergeable-object.ts @@ -1,36 +1,35 @@ +import type { Options } from "deepmerge" import { deepmerge as merge } from "deepmerge" import test from "tape" -test('isMergeable function copying object over object', function(t) { - var src = { key: { isMergeable: false }, baz: 'yes' } - var target = { key: { foo: 'wat' }, baz: 'whatever' } +test(`isMergeable function copying object over object`, (t) => { + const src = { key: { isMergeable: false }, baz: `yes` } + const target = { key: { foo: `wat` }, baz: `whatever` } - function customIsMergeable(object) { - return object && typeof object === 'object' && object.isMergeable !== false - } + const customIsMergeable: Options[`isMergeable`] = (object) => + object && typeof object === `object` && object.isMergeable !== false - var res = merge(target, src, { - isMergeable: customIsMergeable + const res = merge(target, src, { + isMergeable: customIsMergeable, }) - t.deepEqual(res, { key: { isMergeable: false }, baz: 'yes' }) - t.equal(res.key, src.key, 'Object has the same identity and was not cloned') + t.deepEqual(res, { key: { isMergeable: false }, baz: `yes` }) + t.equal(res.key, src.key, `Object has the same identity and was not cloned`) t.end() }) -test('isMergeable function copying object over nothing', function(t) { - var src = { key: { isMergeable: false, foo: 'bar' }, baz: 'yes' } - var target = { baz: 'whatever' } +test(`isMergeable function copying object over nothing`, (t) => { + const src = { key: { isMergeable: false, foo: `bar` }, baz: `yes` } + const target = { baz: `whatever` } - function customIsMergeable(object) { - return object && typeof object === 'object' && object.isMergeable !== false - } + const customIsMergeable: Options[`isMergeable`] = (object) => + object && typeof object === `object` && object.isMergeable !== false - var res = merge(target, src, { - isMergeable: customIsMergeable + const res = merge(target, src, { + isMergeable: customIsMergeable, }) - t.deepEqual(res, { key: { isMergeable: false, foo: 'bar' }, baz: 'yes' }) - t.equal(res.key, src.key, 'Object has the same identity and was not cloned') + t.deepEqual(res, { key: { isMergeable: false, foo: `bar` }, baz: `yes` }) + t.equal(res.key, src.key, `Object has the same identity and was not cloned`) t.end() }) diff --git a/test/merge-all.ts b/test/merge-all.ts index 03f1074..aed5419 100644 --- a/test/merge-all.ts +++ b/test/merge-all.ts @@ -1,57 +1,57 @@ import { deepmergeAll as mergeAll } from "deepmerge" import test from "tape" -test('throw error if first argument is not an array', function(t) { - // @ts-expect-error - t.throws(mergeAll.bind(null, { example: true }, { another: '2' }), Error) +test(`throw error if first argument is not an array`, (t) => { + // @ts-expect-error -- Calling mergeAll without passing in an array. + t.throws(mergeAll.bind(null, { example: true }, { another: `2` }), Error) t.end() }) -test('return an empty object if first argument is an array with no elements', function(t) { +test(`return an empty object if first argument is an array with no elements`, (t) => { t.deepEqual(mergeAll([]), {}) t.end() }) -test('Work just fine if first argument is an array with least than two elements', function(t) { - var actual = mergeAll([{ example: true }]) - var expected = { example: true } +test(`Work just fine if first argument is an array with least than two elements`, (t) => { + const actual = mergeAll([{ example: true }]) + const expected = { example: true } t.deepEqual(actual, expected) t.end() }) -test('execute correctly if options object were not passed', function(t) { - var arrayToMerge = [{ example: true }, { another: '123' }] +test(`execute correctly if options object were not passed`, (t) => { + const arrayToMerge = [{ example: true }, { another: `123` }] t.doesNotThrow(mergeAll.bind(null, arrayToMerge)) t.end() }) -test('execute correctly if options object were passed', function(t) { - var arrayToMerge = [{ example: true }, { another: '123' }] +test(`execute correctly if options object were passed`, (t) => { + const arrayToMerge = [{ example: true }, { another: `123` }] t.doesNotThrow(mergeAll.bind(null, arrayToMerge, { clone: true })) t.end() }) -test('invoke merge on every item in array should result with all props', function(t) { - var firstObject = { first: true } - var secondObject = { second: false } - var thirdObject = { third: 123 } - var fourthObject = { fourth: 'some string' } +test(`invoke merge on every item in array should result with all props`, (t) => { + const firstObject = { first: true } + const secondObject = { second: false } + const thirdObject = { third: 123 } + const fourthObject = { fourth: `some string` } - var mergedObject = mergeAll([ firstObject, secondObject, thirdObject, fourthObject ]) + const mergedObject = mergeAll([ firstObject, secondObject, thirdObject, fourthObject ]) t.ok(mergedObject.first === true) t.ok(mergedObject.second === false) t.ok(mergedObject.third === 123) - t.ok(mergedObject.fourth === 'some string') + t.ok(mergedObject.fourth === `some string`) t.end() }) -test('invoke merge on every item in array with clone should clone all elements', function(t) { - var firstObject = { a: { d: 123 } } - var secondObject = { b: { e: true } } - var thirdObject = { c: { f: 'string' } } +test(`invoke merge on every item in array with clone should clone all elements`, (t) => { + const firstObject = { a: { d: 123 } } + const secondObject = { b: { e: true } } + const thirdObject = { c: { f: `string` } } - var mergedWithClone = mergeAll([ firstObject, secondObject, thirdObject ], { clone: true }) + const mergedWithClone = mergeAll([ firstObject, secondObject, thirdObject ], { clone: true }) t.notEqual(mergedWithClone.a, firstObject.a) t.notEqual(mergedWithClone.b, secondObject.b) @@ -60,12 +60,12 @@ test('invoke merge on every item in array with clone should clone all elements', t.end() }) -test('invoke merge on every item in array clone=false should not clone all elements', function(t) { - var firstObject = { a: { d: 123 } } - var secondObject = { b: { e: true } } - var thirdObject = { c: { f: 'string' } } +test(`invoke merge on every item in array clone=false should not clone all elements`, (t) => { + const firstObject = { a: { d: 123 } } + const secondObject = { b: { e: true } } + const thirdObject = { c: { f: `string` } } - var mergedWithoutClone = mergeAll([ firstObject, secondObject, thirdObject ], { clone: false }) + const mergedWithoutClone = mergeAll([ firstObject, secondObject, thirdObject ], { clone: false }) t.equal(mergedWithoutClone.a, firstObject.a) t.equal(mergedWithoutClone.b, secondObject.b) @@ -75,12 +75,12 @@ test('invoke merge on every item in array clone=false should not clone all eleme }) -test('invoke merge on every item in array without clone should clone all elements', function(t) { - var firstObject = { a: { d: 123 } } - var secondObject = { b: { e: true } } - var thirdObject = { c: { f: 'string' } } +test(`invoke merge on every item in array without clone should clone all elements`, (t) => { + const firstObject = { a: { d: 123 } } + const secondObject = { b: { e: true } } + const thirdObject = { c: { f: `string` } } - var mergedWithoutClone = mergeAll([ firstObject, secondObject, thirdObject ]) + const mergedWithoutClone = mergeAll([ firstObject, secondObject, thirdObject ]) t.notEqual(mergedWithoutClone.a, firstObject.a) t.notEqual(mergedWithoutClone.b, secondObject.b) @@ -89,12 +89,12 @@ test('invoke merge on every item in array without clone should clone all element t.end() }) -test('With clone: false, mergeAll should not clone the target root', t => { +test(`With clone: false, mergeAll should not clone the target root`, (t) => { const destination = {} const output = mergeAll([ destination, { - sup: true - } + sup: true, + }, ], { clone: false }) t.equal(destination, output) diff --git a/test/merge-plain-objects.ts b/test/merge-plain-objects.ts index 7722f87..c1c4964 100644 --- a/test/merge-plain-objects.ts +++ b/test/merge-plain-objects.ts @@ -1,10 +1,10 @@ import { deepmerge as merge } from "deepmerge" import test from "tape" -test('plain objects are merged by default', function(t) { +test(`plain objects are merged by default`, (t) => { const input = { newObject: new Object(), - objectLiteral: { a: 123 } + objectLiteral: { a: 123 }, } const output = merge({}, input) @@ -16,11 +16,11 @@ test('plain objects are merged by default', function(t) { t.end() }) -test('instantiated objects are copied by reference', function(t) { +test(`instantiated objects are copied by reference`, (t) => { const input = { date: new Date(), error: new Error(), - regex: /regex/ + regex: /regex/, } const output = merge({}, input) diff --git a/test/merge.ts b/test/merge.ts index 3d2be9d..159bbc2 100644 --- a/test/merge.ts +++ b/test/merge.ts @@ -1,104 +1,105 @@ +import type { Options } from "deepmerge" import { deepmerge as merge } from "deepmerge" import test from "tape" -test('add keys in target that do not exist at the root', function(t) { - var src = { key1: 'value1', key2: 'value2' } - var target = {} +test(`add keys in target that do not exist at the root`, (t) => { + const src = { key1: `value1`, key2: `value2` } + const target = {} - var res = merge(target, src) + const res = merge(target, src) - t.deepEqual(target, {}, 'merge should be immutable') + t.deepEqual(target, {}, `merge should be immutable`) t.deepEqual(res, src) t.end() }) -test('merge existing simple keys in target at the roots', function(t) { - var src = { key1: 'changed', key2: 'value2' } - var target = { key1: 'value1', key3: 'value3' } +test(`merge existing simple keys in target at the roots`, (t) => { + const src = { key1: `changed`, key2: `value2` } + const target = { key1: `value1`, key3: `value3` } - var expected = { - key1: 'changed', - key2: 'value2', - key3: 'value3', + const expected = { + key1: `changed`, + key2: `value2`, + key3: `value3`, } - t.deepEqual(target, { key1: 'value1', key3: 'value3' }) + t.deepEqual(target, { key1: `value1`, key3: `value3` }) t.deepEqual(merge(target, src), expected) t.end() }) -test('merge nested objects into target', function(t) { - var src = { +test(`merge nested objects into target`, (t) => { + const src = { key1: { - subkey1: 'changed', - subkey3: 'added', + subkey1: `changed`, + subkey3: `added`, }, } - var target = { + const target = { key1: { - subkey1: 'value1', - subkey2: 'value2', + subkey1: `value1`, + subkey2: `value2`, }, } - var expected = { + const expected = { key1: { - subkey1: 'changed', - subkey2: 'value2', - subkey3: 'added', + subkey1: `changed`, + subkey2: `value2`, + subkey3: `added`, }, } t.deepEqual(target, { key1: { - subkey1: 'value1', - subkey2: 'value2', + subkey1: `value1`, + subkey2: `value2`, }, }) t.deepEqual(merge(target, src), expected) t.end() }) -test('replace simple key with nested object in target', function(t) { - var src = { +test(`replace simple key with nested object in target`, (t) => { + const src = { key1: { - subkey1: 'subvalue1', - subkey2: 'subvalue2', + subkey1: `subvalue1`, + subkey2: `subvalue2`, }, } - var target = { - key1: 'value1', - key2: 'value2', + const target = { + key1: `value1`, + key2: `value2`, } - var expected = { + const expected = { key1: { - subkey1: 'subvalue1', - subkey2: 'subvalue2', + subkey1: `subvalue1`, + subkey2: `subvalue2`, }, - key2: 'value2', + key2: `value2`, } - t.deepEqual(target, { key1: 'value1', key2: 'value2' }) + t.deepEqual(target, { key1: `value1`, key2: `value2` }) t.deepEqual(merge(target, src), expected) t.end() }) -test('should add nested object in target', function(t) { - var src = { - "b": { - "c": {}, +test(`should add nested object in target`, (t) => { + const src = { + b: { + c: {}, }, } - var target = { - "a": {}, + const target = { + a: {}, } - var expected = { - "a": {}, - "b": { - "c": {}, + const expected = { + a: {}, + b: { + c: {}, }, } @@ -106,29 +107,29 @@ test('should add nested object in target', function(t) { t.end() }) -test('should clone source and target', function(t) { - var src = { - "b": { - "c": "foo", +test(`should clone source and target`, (t) => { + const src = { + b: { + c: `foo`, }, } - var target = { - "a": { - "d": "bar", + const target = { + a: { + d: `bar`, }, } - var expected = { - "a": { - "d": "bar", + const expected = { + a: { + d: `bar`, }, - "b": { - "c": "foo", + b: { + c: `foo`, }, } - var merged = merge(target, src, { clone: true }) + const merged = merge(target, src, { clone: true }) t.deepEqual(merged, expected) @@ -138,133 +139,133 @@ test('should clone source and target', function(t) { t.end() }) -test('should clone source and target', function(t) { - var src = { - "b": { - "c": "foo", +test(`should clone source and target`, (t) => { + const src = { + b: { + c: `foo`, }, } - var target = { - "a": { - "d": "bar", + const target = { + a: { + d: `bar`, }, } - var merged = merge(target, src) + const merged = merge(target, src) t.notEqual(merged.a, target.a) t.notEqual(merged.b, src.b) t.end() }) -test('should replace object with simple key in target', function(t) { - var src = { key1: 'value1' } - var target = { +test(`should replace object with simple key in target`, (t) => { + const src = { key1: `value1` } + const target = { key1: { - subkey1: 'subvalue1', - subkey2: 'subvalue2', + subkey1: `subvalue1`, + subkey2: `subvalue2`, }, - key2: 'value2', + key2: `value2`, } - var expected = { key1: 'value1', key2: 'value2' } + const expected = { key1: `value1`, key2: `value2` } t.deepEqual(target, { key1: { - subkey1: 'subvalue1', - subkey2: 'subvalue2', + subkey1: `subvalue1`, + subkey2: `subvalue2`, }, - key2: 'value2', + key2: `value2`, }) t.deepEqual(merge(target, src), expected) t.end() }) -test('should replace objects with arrays', function(t) { - var target = { key1: { subkey: 'one' } } +test(`should replace objects with arrays`, (t) => { + const target = { key1: { subkey: `one` } } - var src = { key1: [ 'subkey' ] } + const src = { key1: [ `subkey` ] } - var expected = { key1: [ 'subkey' ] } + const expected = { key1: [ `subkey` ] } t.deepEqual(merge(target, src), expected) t.end() }) -test('should replace arrays with objects', function(t) { - var target = { key1: [ "subkey" ] } +test(`should replace arrays with objects`, (t) => { + const target = { key1: [ `subkey` ] } - var src = { key1: { subkey: 'one' } } + const src = { key1: { subkey: `one` } } - var expected = { key1: { subkey: 'one' } } + const expected = { key1: { subkey: `one` } } t.deepEqual(merge(target, src), expected) t.end() }) -test('should replace dates with arrays', function(t) { - var target = { key1: new Date() } +test(`should replace dates with arrays`, (t) => { + const target = { key1: new Date() } - var src = { key1: [ "subkey" ] } + const src = { key1: [ `subkey` ] } - var expected = { key1: [ "subkey" ] } + const expected = { key1: [ `subkey` ] } t.deepEqual(merge(target, src), expected) t.end() }) -test('should replace null with arrays', function(t) { - var target = { +test(`should replace null with arrays`, (t) => { + const target = { key1: null, } - var src = { - key1: [ "subkey" ], + const src = { + key1: [ `subkey` ], } - var expected = { - key1: [ "subkey" ], + const expected = { + key1: [ `subkey` ], } t.deepEqual(merge(target, src), expected) t.end() }) -test('should work on simple array', function(t) { - var src = [ 'one', 'three' ] - var target = [ 'one', 'two' ] +test(`should work on simple array`, (t) => { + const src = [ `one`, `three` ] + const target = [ `one`, `two` ] - var expected = [ 'one', 'two', 'one', 'three' ] + const expected = [ `one`, `two`, `one`, `three` ] t.deepEqual(merge(target, src), expected) t.ok(Array.isArray(merge(target, src))) t.end() }) -test('should work on another simple array', function(t) { - var target = [ "a1", "a2", "c1", "f1", "p1" ] - var src = [ "t1", "s1", "c2", "r1", "p2", "p3" ] +test(`should work on another simple array`, (t) => { + const target = [ `a1`, `a2`, `c1`, `f1`, `p1` ] + const src = [ `t1`, `s1`, `c2`, `r1`, `p2`, `p3` ] - var expected = [ "a1", "a2", "c1", "f1", "p1", "t1", "s1", "c2", "r1", "p2", "p3" ] - t.deepEqual(target, [ "a1", "a2", "c1", "f1", "p1" ]) + const expected = [ `a1`, `a2`, `c1`, `f1`, `p1`, `t1`, `s1`, `c2`, `r1`, `p2`, `p3` ] + t.deepEqual(target, [ `a1`, `a2`, `c1`, `f1`, `p1` ]) t.deepEqual(merge(target, src), expected) t.ok(Array.isArray(merge(target, src))) t.end() }) -test('should work on array properties', function(t) { - var src = { - key1: [ 'one', 'three' ], - key2: [ 'four' ], +test(`should work on array properties`, (t) => { + const src = { + key1: [ `one`, `three` ], + key2: [ `four` ], } - var target = { - key1: [ 'one', 'two' ], + const target = { + key1: [ `one`, `two` ], } - var expected = { - key1: [ 'one', 'two', 'one', 'three' ], - key2: [ 'four' ], + const expected = { + key1: [ `one`, `two`, `one`, `three` ], + key2: [ `four` ], } t.deepEqual(merge(target, src), expected) @@ -273,183 +274,183 @@ test('should work on array properties', function(t) { t.end() }) -test('should work on array properties with clone option', function(t) { - var src = { - key1: [ 'one', 'three' ], - key2: [ 'four' ], +test(`should work on array properties with clone option`, (t) => { + const src = { + key1: [ `one`, `three` ], + key2: [ `four` ], } - var target = { - key1: [ 'one', 'two' ], + const target = { + key1: [ `one`, `two` ], } t.deepEqual(target, { - key1: [ 'one', 'two' ], + key1: [ `one`, `two` ], }) - var merged = merge(target, src, { clone: true }) + const merged = merge(target, src, { clone: true }) t.notEqual(merged.key1, src.key1) t.notEqual(merged.key1, target.key1) t.notEqual(merged.key2, src.key2) t.end() }) -test('should work on array of objects', function(t) { - var src = [ - { key1: [ 'one', 'three' ], key2: [ 'one' ] }, - { key3: [ 'five' ] }, +test(`should work on array of objects`, (t) => { + const src = [ + { key1: [ `one`, `three` ], key2: [ `one` ] }, + { key3: [ `five` ] }, ] - var target = [ - { key1: [ 'one', 'two' ] }, - { key3: [ 'four' ] }, + const target = [ + { key1: [ `one`, `two` ] }, + { key3: [ `four` ] }, ] - var expected = [ - { key1: [ 'one', 'two' ] }, - { key3: [ 'four' ] }, - { key1: [ 'one', 'three' ], key2: [ 'one' ] }, - { key3: [ 'five' ] }, + const expected = [ + { key1: [ `one`, `two` ] }, + { key3: [ `four` ] }, + { key1: [ `one`, `three` ], key2: [ `one` ] }, + { key3: [ `five` ] }, ] t.deepEqual(merge(target, src), expected) - t.ok(Array.isArray(merge(target, src)), 'result should be an array') - t.ok(Array.isArray(merge(target, src)[0].key1), 'subkey should be an array too') + t.ok(Array.isArray(merge(target, src)), `result should be an array`) + t.ok(Array.isArray(merge(target, src)[0].key1), `subkey should be an array too`) t.end() }) -test('should work on array of objects with clone option', function(t) { - var src = [ - { key1: [ 'one', 'three' ], key2: [ 'one' ] }, - { key3: [ 'five' ] }, +test(`should work on array of objects with clone option`, (t) => { + const src = [ + { key1: [ `one`, `three` ], key2: [ `one` ] }, + { key3: [ `five` ] }, ] - var target = [ - { key1: [ 'one', 'two' ] }, - { key3: [ 'four' ] }, + const target = [ + { key1: [ `one`, `two` ] }, + { key3: [ `four` ] }, ] - var expected = [ - { key1: [ 'one', 'two' ] }, - { key3: [ 'four' ] }, - { key1: [ 'one', 'three' ], key2: [ 'one' ] }, - { key3: [ 'five' ] }, + const expected = [ + { key1: [ `one`, `two` ] }, + { key3: [ `four` ] }, + { key1: [ `one`, `three` ], key2: [ `one` ] }, + { key3: [ `five` ] }, ] - var merged = merge(target, src, { clone: true }) + const merged = merge(target, src, { clone: true }) t.deepEqual(merged, expected) - t.ok(Array.isArray(merge(target, src)), 'result should be an array') - t.ok(Array.isArray(merge(target, src)[0].key1), 'subkey should be an array too') + t.ok(Array.isArray(merge(target, src)), `result should be an array`) + t.ok(Array.isArray(merge(target, src)[0].key1), `subkey should be an array too`) t.notEqual(merged[0].key1, src[0].key1) t.notEqual(merged[0].key1, target[0].key1) - t.false(Object.prototype.hasOwnProperty.call(merged[0], 'key2'), '"key2" should not exist on "merged[0]"'); + t.false(Object.prototype.hasOwnProperty.call(merged[0], `key2`), `"key2" should not exist on "merged[0]"`) t.notEqual(merged[1].key3, src[1].key3) t.notEqual(merged[1].key3, target[1].key3) t.end() }) -test('should treat regular expressions like primitive values', function(t) { - var target = { key1: /abc/ } - var src = { key1: /efg/ } - var expected = { key1: /efg/ } +test(`should treat regular expressions like primitive values`, (t) => { + const target = { key1: /abc/ } + const src = { key1: /efg/ } + const expected = { key1: /efg/ } t.deepEqual(merge(target, src), expected) - t.deepEqual(merge(target, src).key1.test('efg'), true) + t.deepEqual(merge(target, src).key1.test(`efg`), true) t.end() }) -test('should treat regular expressions like primitive values and should not' - + ' clone even with clone option', function(t) { - var target = { key1: /abc/ } - var src = { key1: /efg/ } +test(`should treat regular expressions like primitive values and should not` + + ` clone even with clone option`, (t) => { + const target = { key1: /abc/ } + const src = { key1: /efg/ } - var output = merge(target, src, { clone: true }) + const output = merge(target, src, { clone: true }) t.equal(output.key1, src.key1) t.end() -} +}, ) -test('should treat dates like primitives', function(t) { - var monday = new Date('2016-09-27T01:08:12.761Z') - var tuesday = new Date('2016-09-28T01:18:12.761Z') +test(`should treat dates like primitives`, (t) => { + const monday = new Date(`2016-09-27T01:08:12.761Z`) + const tuesday = new Date(`2016-09-28T01:18:12.761Z`) - var target = { + const target = { key: monday, } - var source = { + const source = { key: tuesday, } - var expected = { + const expected = { key: tuesday, } - var actual = merge(target, source) + const actual = merge(target, source) t.deepEqual(actual, expected) t.equal(actual.key.valueOf(), tuesday.valueOf()) t.end() }) -test('should treat dates like primitives and should not clone even with clone' - + ' option', function(t) { - var monday = new Date('2016-09-27T01:08:12.761Z') - var tuesday = new Date('2016-09-28T01:18:12.761Z') +test(`should treat dates like primitives and should not clone even with clone` + + ` option`, (t) => { + const monday = new Date(`2016-09-27T01:08:12.761Z`) + const tuesday = new Date(`2016-09-28T01:18:12.761Z`) - var target = { + const target = { key: monday, } - var source = { + const source = { key: tuesday, } - var actual = merge(target, source, { clone: true }) + const actual = merge(target, source, { clone: true }) t.equal(actual.key, tuesday) t.end() }) -test('should work on array with null in it', function(t) { - var target = [] +test(`should work on array with null in it`, (t) => { + const target = [] - var src = [ null ] + const src = [ null ] - var expected = [ null ] + const expected = [ null ] t.deepEqual(merge(target, src), expected) t.end() }) -test('should clone array\'s element if it is object', function(t) { - var a = { key: 'yup' } - var target = [] - var source = [ a ] +test(`should clone array's element if it is object`, (t) => { + const a = { key: `yup` } + const target = [] + const source = [ a ] - var output = merge(target, source, { clone: true }) + const output = merge(target, source, { clone: true }) t.notEqual(output[0], a) - t.equal(output[0].key, 'yup') + t.equal(output[0].key, `yup`) t.end() }) -test('should clone an array property when there is no target array', function(t) { +test(`should clone an array property when there is no target array`, (t) => { const someObject = {} - var target = {} - var source = { ary: [ someObject ] } - var output = merge(target, source, { clone: true }) + const target = {} + const source = { ary: [ someObject ] } + const output = merge(target, source, { clone: true }) t.deepEqual(output, { ary: [{}] }) t.notEqual(output.ary[0], someObject) t.end() }) -test('should overwrite values when property is initialised but undefined', function(t) { - var target1 = { value: [] } - var target2 = { value: null } - var target3 = { value: 2 } +test(`should overwrite values when property is initialised but undefined`, (t) => { + const target1 = { value: [] } + const target2 = { value: null } + const target3 = { value: 2 } - var src = { value: undefined } + const src = { value: undefined } function hasUndefinedProperty(o) { - t.ok(o.hasOwnProperty('value')) - t.equal(typeof o.value, 'undefined') + t.ok(Object.prototype.hasOwnProperty.call(o, `value`)) + t.equal(typeof o.value, `undefined`) } hasUndefinedProperty(merge(target1, src)) @@ -459,231 +460,220 @@ test('should overwrite values when property is initialised but undefined', funct t.end() }) -test('dates should copy correctly in an array', function(t) { - var monday = new Date('2016-09-27T01:08:12.761Z') - var tuesday = new Date('2016-09-28T01:18:12.761Z') +test(`dates should copy correctly in an array`, (t) => { + const monday = new Date(`2016-09-27T01:08:12.761Z`) + const tuesday = new Date(`2016-09-28T01:18:12.761Z`) - var target = [ monday, 'dude' ] - var source = [ tuesday, 'lol' ] + const target = [ monday, `dude` ] + const source = [ tuesday, `lol` ] - var expected = [ monday, 'dude', tuesday, 'lol' ] - var actual = merge(target, source) + const expected = [ monday, `dude`, tuesday, `lol` ] + const actual = merge(target, source) t.deepEqual(actual, expected) t.end() }) -test('should handle custom merge functions', function(t) { - var target = { - letters: ['a', 'b'], +test(`should handle custom merge functions`, (t) => { + const target = { + letters: [ `a`, `b` ], people: { - first: 'Alex', - second: 'Bert', - } + first: `Alex`, + second: `Bert`, + }, } - var source = { - letters: ['c'], + const source = { + letters: [ `c` ], people: { - first: 'Smith', - second: 'Bertson', - third: 'Car' - } - } - - const mergePeople = (target, source, options) => { - const keys = new Set(Object.keys(target).concat(Object.keys(source))) - const destination = {} - keys.forEach(key => { - if (key in target && key in source) { - destination[key] = `${target[key]}-${source[key]}` - } else if (key in target) { - destination[key] = target[key] - } else { - destination[key] = source[key] - } - }) - return destination - } - - const options = { - customMerge: (key) => { - if (key === 'people') { - return mergePeople - } - - return merge - } - } - - var expected = { - letters: ['a', 'b', 'c'], + first: `Smith`, + second: `Bertson`, + third: `Car`, + }, + } + + const mergePeople = (target: Record, source: Record) => { + const keys = new Set(Object.keys(target).concat(Object.keys(source))) + const destination = {} + keys.forEach((key) => { + if (key in target && key in source) { + destination[key] = `${ target[key] }-${ source[key] }` + } else if (key in target) { + destination[key] = target[key] + } else { + destination[key] = source[key] + } + }) + return destination + } + + const options: Options = { + customMerge: (key) => { + if (key === `people`) { + return mergePeople + } + + return merge + }, + } + + const expected = { + letters: [ `a`, `b`, `c` ], people: { - first: 'Alex-Smith', - second: 'Bert-Bertson', - third: 'Car' - } + first: `Alex-Smith`, + second: `Bert-Bertson`, + third: `Car`, + }, } - var actual = merge(target, source, options) + const actual = merge(target, source, options) t.deepEqual(actual, expected) t.end() }) -test('should handle custom merge functions', function(t) { - var target = { - letters: ['a', 'b'], +test(`should handle custom merge functions`, (t) => { + const target = { + letters: [ `a`, `b` ], people: { - first: 'Alex', - second: 'Bert', - } + first: `Alex`, + second: `Bert`, + }, + } + + const source = { + letters: [ `c` ], + people: { + first: `Smith`, + second: `Bertson`, + third: `Car`, + }, + } + + const mergeLetters = (_target: string, _source: string) => `merged letters` + + const options: Options = { + customMerge: (key) => { + if (key === `letters`) { + return mergeLetters + } + }, } - var source = { - letters: ['c'], + const expected = { + letters: `merged letters`, people: { - first: 'Smith', - second: 'Bertson', - third: 'Car' - } - } - - const mergeLetters = (target, source, options) => { - return 'merged letters' - } - - - const options = { - customMerge: (key) => { - if (key === 'letters') { - return mergeLetters - } - } - } - - const expected = { - letters: 'merged letters', - people: { - first: 'Smith', - second: 'Bertson', - third: 'Car' - } - } - - var actual = merge(target, source, options) + first: `Smith`, + second: `Bertson`, + third: `Car`, + }, + } + + const actual = merge(target, source, options) t.deepEqual(actual, expected) t.end() }) -test('should merge correctly if custom merge is not a valid function', function(t) { - var target = { - letters: ['a', 'b'], +test(`should merge correctly if custom merge is not a valid function`, (t) => { + const target = { + letters: [ `a`, `b` ], people: { - first: 'Alex', - second: 'Bert', - } + first: `Alex`, + second: `Bert`, + }, } - var source = { - letters: ['c'], + const source = { + letters: [ `c` ], people: { - first: 'Smith', - second: 'Bertson', - third: 'Car' - } - } - - const options = { - customMerge: (key, options) => { - return false - } - } - - const expected = { - letters: ['a', 'b', 'c'], - people: { - first: 'Smith', - second: 'Bertson', - third: 'Car' - } - } - - var actual = merge(target, source) + first: `Smith`, + second: `Bertson`, + third: `Car`, + }, + } + + const expected = { + letters: [ `a`, `b`, `c` ], + people: { + first: `Smith`, + second: `Bertson`, + third: `Car`, + }, + } + + const actual = merge(target, source) t.deepEqual(actual, expected) t.end() - }) -test('copy symbol keys in target that do not exist on the target', function(t) { - var mySymbol = Symbol(); - var src = { [mySymbol]: 'value1' } - var target = {} +test(`copy symbol keys in target that do not exist on the target`, (t) => { + const mySymbol = Symbol() + const src = { [mySymbol]: `value1` } + const target = {} - var res = merge(target, src) + const res = merge(target, src) - t.equal(res[mySymbol], 'value1') + t.equal(res[mySymbol], `value1`) t.deepEqual(Object.getOwnPropertySymbols(res), Object.getOwnPropertySymbols(src)) t.end() }) -test('copy symbol keys in target that do exist on the target', function(t) { - var mySymbol = Symbol(); - var src = { [mySymbol]: 'value1' } - var target = { [mySymbol]: 'wat'} +test(`copy symbol keys in target that do exist on the target`, (t) => { + const mySymbol = Symbol() + const src = { [mySymbol]: `value1` } + const target = { [mySymbol]: `wat` } - var res = merge(target, src) + const res = merge(target, src) - t.equal(res[mySymbol as unknown as string], 'value1') + t.equal(res[mySymbol as unknown as string], `value1`) t.end() }) -test('should not mutate options', function(t) { - var options = {}; +test(`should not mutate options`, (t) => { + const options: Options = {} - merge({}, {}, options); + merge({}, {}, options) - t.deepEqual(options, {}); - t.end(); + t.deepEqual(options, {}) + t.end() }) -test('Falsey properties should be mergeable', function(t) { - var uniqueValue = {} +test(`Falsey properties should be mergeable`, (t) => { + const uniqueValue = {} - var target = { - wat: false + const target = { + wat: false, } - var source = { - wat: false + const source = { + wat: false, } - var customMergeWasCalled = false + let customMergeWasCalled = false - var result = merge(target, source, { - isMergeable: function() { + const result = merge(target, source, { + isMergeable() { return true }, - customMerge: function() { + customMerge() { return function() { customMergeWasCalled = true return uniqueValue } - } + }, }) t.equal(result.wat, uniqueValue) - t.ok(customMergeWasCalled, 'custom merge function was called') + t.ok(customMergeWasCalled, `custom merge function was called`) t.end() }) -test('With clone: false, merge should not clone the target root', t => { +test(`With clone: false, merge should not clone the target root`, (t) => { const destination = {} const output = merge(destination, { - sup: true + sup: true, }, { clone: false }) t.equal(destination, output) t.end() }) - diff --git a/test/prototype-poisoning.ts b/test/prototype-poisoning.ts index 48308fc..95f580e 100644 --- a/test/prototype-poisoning.ts +++ b/test/prototype-poisoning.ts @@ -1,76 +1,76 @@ +import type { Options } from "deepmerge" import { deepmerge as merge } from "deepmerge" -import test from "tape" import isPlainObj from "is-plain-obj" +import test from "tape" -test('merging objects with own __proto__', function(t) { - var user = {} - var malicious = JSON.parse('{ "__proto__": { "admin": true } }') - var mergedObject = merge(user, malicious) - t.notOk(mergedObject.__proto__.admin, 'non-plain properties should not be merged') - t.notOk(mergedObject.admin, 'the destination should have an unmodified prototype') +test(`merging objects with own __proto__`, (t) => { + const user = {} + const malicious = JSON.parse(`{ "__proto__": { "admin": true } }`) + const mergedObject = merge(user, malicious) + t.notOk(mergedObject.__proto__.admin, `non-plain properties should not be merged`) + t.notOk(mergedObject.admin, `the destination should have an unmodified prototype`) t.end() }) -test('merging objects with plain and non-plain properties', function(t) { - var plainSymbolKey = Symbol('plainSymbolKey') - var parent = { - parentKey: 'should be undefined' +test(`merging objects with plain and non-plain properties`, (t) => { + const plainSymbolKey = Symbol(`plainSymbolKey`) + const parent = { + parentKey: `should be undefined`, } - var target = Object.create(parent) - target.plainKey = 'should be replaced' - target[plainSymbolKey] = 'should also be replaced' + const target = Object.create(parent) + target.plainKey = `should be replaced` + target[plainSymbolKey] = `should also be replaced` - var source = { - parentKey: 'foo', - plainKey: 'bar', - newKey: 'baz', - [plainSymbolKey]: 'qux' + const source = { + parentKey: `foo`, + plainKey: `bar`, + newKey: `baz`, + [plainSymbolKey]: `qux`, } - var mergedObject = merge(target, source) - t.equal(undefined, mergedObject.parentKey, 'inherited properties of target should be removed, not merged or ignored') - t.equal('bar', mergedObject.plainKey, 'enumerable own properties of target should be merged') - t.equal('baz', mergedObject.newKey, 'properties not yet on target should be merged') - t.equal('qux', mergedObject[plainSymbolKey], 'enumerable own symbol properties of target should be merged') + const mergedObject = merge(target, source) + t.equal(undefined, mergedObject.parentKey, `inherited properties of target should be removed, not merged or ignored`) + t.equal(`bar`, mergedObject.plainKey, `enumerable own properties of target should be merged`) + t.equal(`baz`, mergedObject.newKey, `properties not yet on target should be merged`) + t.equal(`qux`, mergedObject[plainSymbolKey], `enumerable own symbol properties of target should be merged`) t.end() }) // the following cases come from the thread here: https://github.com/TehShrike/deepmerge/pull/164 -test('merging strings works with a custom string merge', function(t) { - var target = { name: "Alexander" } - var source = { name: "Hamilton" } - function customMerge(key) { - if (key === 'name') { - return function(target, source, options) { - return target[0] + '. ' + source.substring(0, 3) +test(`merging strings works with a custom string merge`, (t) => { + const target = { name: `Alexander` } + const source = { name: `Hamilton` } + const customMerge: Options[`customMerge`] = (key) => { + if (key === `name`) { + return function(target, source) { + return target[0] + `. ` + source.substring(0, 3) } } else { return merge } } - function mergeable(target) { - return isPlainObj(target) || (typeof target === 'string' && target.length > 1) - } + const mergeable: Options[`isMergeable`] = (target) => + isPlainObj(target) || (typeof target === `string` && target.length > 1) - t.equal('A. Ham', merge(target, source, { customMerge: customMerge, isMergeable: mergeable }).name) + t.equal(`A. Ham`, merge(target, source, { customMerge, isMergeable: mergeable }).name) t.end() }) -test('merging objects with null prototype', function(t) { - var target = Object.create(null) - var source = Object.create(null) +test(`merging objects with null prototype`, (t) => { + const target = Object.create(null) + const source = Object.create(null) target.wheels = 4 - target.trunk = { toolbox: ['hammer'] } - source.trunk = { toolbox: ['wrench'] } - source.engine = 'v8' - var expected = { + target.trunk = { toolbox: [ `hammer` ] } + source.trunk = { toolbox: [ `wrench` ] } + source.engine = `v8` + const expected = { wheels: 4, - engine: 'v8', + engine: `v8`, trunk: { - toolbox: ['hammer', 'wrench' ] - } + toolbox: [ `hammer`, `wrench` ], + }, } t.deepEqual(expected, merge(target, source)) From 0a5a3c3bd3034d65fbe43a33d300e1262051195b Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sun, 24 Jan 2021 01:32:37 +1300 Subject: [PATCH 18/22] fix: remove mutating of target with clone=false this is wanted with a new option "mergeWithTarget" --- src/deepmerge.ts | 5 +++-- test/merge-all.ts | 23 ++++++++++++----------- test/merge.ts | 19 ++++++++++--------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/deepmerge.ts b/src/deepmerge.ts index 7f744db..0aa7203 100644 --- a/src/deepmerge.ts +++ b/src/deepmerge.ts @@ -15,7 +15,8 @@ function mergeObject< T2 extends Record, O extends Options >(target: T1, source: T2, options: FullOptions): DeepMergeObjects { - const destination: any = options.clone ? emptyTarget(target) : target + // const destination: any = options.mergeWithTarget ? target : {} + const destination: any = {} if (options.isMergeable(target)) { getKeys(target).forEach( @@ -117,5 +118,5 @@ export function deepmergeAll(objects: ReadonlyArray, options?: Options): : value } - return objects.reduce((prev, next) => deepmergeImpl(prev, next, fullOptions)) + return objects.reduce((prev, next) => deepmergeImpl(prev, next, fullOptions), {}) } diff --git a/test/merge-all.ts b/test/merge-all.ts index aed5419..4d0405b 100644 --- a/test/merge-all.ts +++ b/test/merge-all.ts @@ -89,14 +89,15 @@ test(`invoke merge on every item in array without clone should clone all element t.end() }) -test(`With clone: false, mergeAll should not clone the target root`, (t) => { - const destination = {} - const output = mergeAll([ - destination, { - sup: true, - }, - ], { clone: false }) - - t.equal(destination, output) - t.end() -}) +// test(`With mergeWithTarget=true, mergeAll should mutate the root target`, (t) => { +// const destination = {} +// const output = mergeAll([ +// destination, { +// sup: true, +// }, +// ], { mergeWithTarget: true }) + +// t.notEqual(destination, {}) +// t.equal(destination, output) +// t.end() +// }) diff --git a/test/merge.ts b/test/merge.ts index 159bbc2..50b1d5e 100644 --- a/test/merge.ts +++ b/test/merge.ts @@ -668,12 +668,13 @@ test(`Falsey properties should be mergeable`, (t) => { t.end() }) -test(`With clone: false, merge should not clone the target root`, (t) => { - const destination = {} - const output = merge(destination, { - sup: true, - }, { clone: false }) - - t.equal(destination, output) - t.end() -}) +// test(`With mergeWithTarget=true, merge should mutate the root target`, (t) => { +// const destination = {} +// const output = merge(destination, { +// sup: true, +// }, { mergeWithTarget: true }) + +// t.notEqual(destination, {}) +// t.equal(destination, output) +// t.end() +// }) From 887c988c1a92936cbc3bdc97e28ae1f78626039e Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sun, 24 Jan 2021 01:27:09 +1300 Subject: [PATCH 19/22] test: update test to work with new default behavior of clone=false --- test/merge-all.ts | 7 +++---- test/merge-plain-objects.ts | 6 +++--- test/merge.ts | 8 ++++---- test/prototype-poisoning.ts | 4 ++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/test/merge-all.ts b/test/merge-all.ts index 4d0405b..99b4821 100644 --- a/test/merge-all.ts +++ b/test/merge-all.ts @@ -60,7 +60,7 @@ test(`invoke merge on every item in array with clone should clone all elements`, t.end() }) -test(`invoke merge on every item in array clone=false should not clone all elements`, (t) => { +test(`invoke merge on every item in array with clone=false should not clone all elements`, (t) => { const firstObject = { a: { d: 123 } } const secondObject = { b: { e: true } } const thirdObject = { c: { f: `string` } } @@ -74,13 +74,12 @@ test(`invoke merge on every item in array clone=false should not clone all eleme t.end() }) - -test(`invoke merge on every item in array without clone should clone all elements`, (t) => { +test(`invoke merge on every item in array with clone=true should clone all elements`, (t) => { const firstObject = { a: { d: 123 } } const secondObject = { b: { e: true } } const thirdObject = { c: { f: `string` } } - const mergedWithoutClone = mergeAll([ firstObject, secondObject, thirdObject ]) + const mergedWithoutClone = mergeAll([ firstObject, secondObject, thirdObject ], { clone: true }) t.notEqual(mergedWithoutClone.a, firstObject.a) t.notEqual(mergedWithoutClone.b, secondObject.b) diff --git a/test/merge-plain-objects.ts b/test/merge-plain-objects.ts index c1c4964..0efd771 100644 --- a/test/merge-plain-objects.ts +++ b/test/merge-plain-objects.ts @@ -6,12 +6,12 @@ test(`plain objects are merged by default`, (t) => { newObject: new Object(), objectLiteral: { a: 123 }, } - const output = merge({}, input) + const output = merge({}, input, { clone: false }) t.deepEqual(output.newObject, input.newObject) - t.notEqual(output.newObject, input.newObject) + t.equal(output.newObject, input.newObject) t.deepEqual(output.objectLiteral, input.objectLiteral) - t.notEqual(output.objectLiteral, input.objectLiteral) + t.equal(output.objectLiteral, input.objectLiteral) t.end() }) diff --git a/test/merge.ts b/test/merge.ts index 50b1d5e..3b1bd36 100644 --- a/test/merge.ts +++ b/test/merge.ts @@ -80,8 +80,8 @@ test(`replace simple key with nested object in target`, (t) => { key2: `value2`, } - t.deepEqual(target, { key1: `value1`, key2: `value2` }) - t.deepEqual(merge(target, src), expected) + t.deepEqual(merge(target, src, { clone: true }), expected) + t.deepEqual(merge(target, src, { clone: false }), expected) t.end() }) @@ -139,7 +139,7 @@ test(`should clone source and target`, (t) => { t.end() }) -test(`should clone source and target`, (t) => { +test(`should clone source and target if specified`, (t) => { const src = { b: { c: `foo`, @@ -152,7 +152,7 @@ test(`should clone source and target`, (t) => { }, } - const merged = merge(target, src) + const merged = merge(target, src, { clone: true }) t.notEqual(merged.a, target.a) t.notEqual(merged.b, src.b) diff --git a/test/prototype-poisoning.ts b/test/prototype-poisoning.ts index 95f580e..cd1379c 100644 --- a/test/prototype-poisoning.ts +++ b/test/prototype-poisoning.ts @@ -29,7 +29,7 @@ test(`merging objects with plain and non-plain properties`, (t) => { [plainSymbolKey]: `qux`, } - const mergedObject = merge(target, source) + const mergedObject = merge(target, source, { clone: true }) t.equal(undefined, mergedObject.parentKey, `inherited properties of target should be removed, not merged or ignored`) t.equal(`bar`, mergedObject.plainKey, `enumerable own properties of target should be merged`) t.equal(`baz`, mergedObject.newKey, `properties not yet on target should be merged`) @@ -73,6 +73,6 @@ test(`merging objects with null prototype`, (t) => { }, } - t.deepEqual(expected, merge(target, source)) + t.deepEqual(merge(target, source, { clone: true }), expected) t.end() }) From 678eda3fafaebc8501658a00af371a7598c004ca Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sun, 24 Jan 2021 01:59:25 +1300 Subject: [PATCH 20/22] refactor: rename merge and mergeAll to deepmerge and deepmergeAll --- test/custom-array-merge.ts | 12 ++-- test/custom-is-mergeable-object.ts | 6 +- test/merge-all.ts | 20 +++---- test/merge-plain-objects.ts | 6 +- test/merge.ts | 96 +++++++++++++++--------------- test/prototype-poisoning.ts | 12 ++-- 6 files changed, 76 insertions(+), 76 deletions(-) diff --git a/test/custom-array-merge.ts b/test/custom-array-merge.ts index 29084d0..bc6c827 100644 --- a/test/custom-array-merge.ts +++ b/test/custom-array-merge.ts @@ -1,5 +1,5 @@ import type { Options } from "deepmerge" -import { deepmerge as merge } from "deepmerge" +import { deepmerge } from "deepmerge" import test from "tape" test(`custom merge array`, (t) => { @@ -20,7 +20,7 @@ test(`custom merge array`, (t) => { someArray: [ 1, 2, 3 ], } - const actual = merge(destination, source, { arrayMerge: overwriteMerge }) + const actual = deepmerge(destination, source, { arrayMerge: overwriteMerge }) const expected = { someArray: [ 1, 2, 3 ], someObject: { what: `yes` }, @@ -34,7 +34,7 @@ test(`custom merge array`, (t) => { test(`merge top-level arrays`, (t) => { const overwriteMerge: Options[`arrayMerge`] = (a, b) => b - const actual = merge([ 1, 2 ], [ 1, 2 ], { arrayMerge: overwriteMerge }) + const actual = deepmerge([ 1, 2 ], [ 1, 2 ], { arrayMerge: overwriteMerge }) const expected = [ 1, 2 ] t.deepEqual(actual, expected) @@ -63,9 +63,9 @@ test(`cloner function is available for merge functions to use`, (t) => { key2: [ `four` ], } - t.deepEqual(merge(target, src, { arrayMerge: cloneMerge }), expected) + t.deepEqual(deepmerge(target, src, { arrayMerge: cloneMerge }), expected) t.ok(customMergeWasCalled) - t.ok(Array.isArray(merge(target, src).key1)) - t.ok(Array.isArray(merge(target, src).key2)) + t.ok(Array.isArray(deepmerge(target, src).key1)) + t.ok(Array.isArray(deepmerge(target, src).key2)) t.end() }) diff --git a/test/custom-is-mergeable-object.ts b/test/custom-is-mergeable-object.ts index d76f628..4f4df08 100644 --- a/test/custom-is-mergeable-object.ts +++ b/test/custom-is-mergeable-object.ts @@ -1,5 +1,5 @@ import type { Options } from "deepmerge" -import { deepmerge as merge } from "deepmerge" +import { deepmerge } from "deepmerge" import test from "tape" test(`isMergeable function copying object over object`, (t) => { @@ -9,7 +9,7 @@ test(`isMergeable function copying object over object`, (t) => { const customIsMergeable: Options[`isMergeable`] = (object) => object && typeof object === `object` && object.isMergeable !== false - const res = merge(target, src, { + const res = deepmerge(target, src, { isMergeable: customIsMergeable, }) @@ -25,7 +25,7 @@ test(`isMergeable function copying object over nothing`, (t) => { const customIsMergeable: Options[`isMergeable`] = (object) => object && typeof object === `object` && object.isMergeable !== false - const res = merge(target, src, { + const res = deepmerge(target, src, { isMergeable: customIsMergeable, }) diff --git a/test/merge-all.ts b/test/merge-all.ts index 99b4821..13c7e38 100644 --- a/test/merge-all.ts +++ b/test/merge-all.ts @@ -1,19 +1,19 @@ -import { deepmergeAll as mergeAll } from "deepmerge" +import { deepmergeAll } from "deepmerge" import test from "tape" test(`throw error if first argument is not an array`, (t) => { // @ts-expect-error -- Calling mergeAll without passing in an array. - t.throws(mergeAll.bind(null, { example: true }, { another: `2` }), Error) + t.throws(deepmergeAll.bind(null, { example: true }, { another: `2` }), Error) t.end() }) test(`return an empty object if first argument is an array with no elements`, (t) => { - t.deepEqual(mergeAll([]), {}) + t.deepEqual(deepmergeAll([]), {}) t.end() }) test(`Work just fine if first argument is an array with least than two elements`, (t) => { - const actual = mergeAll([{ example: true }]) + const actual = deepmergeAll([{ example: true }]) const expected = { example: true } t.deepEqual(actual, expected) t.end() @@ -21,13 +21,13 @@ test(`Work just fine if first argument is an array with least than two elements` test(`execute correctly if options object were not passed`, (t) => { const arrayToMerge = [{ example: true }, { another: `123` }] - t.doesNotThrow(mergeAll.bind(null, arrayToMerge)) + t.doesNotThrow(deepmergeAll.bind(null, arrayToMerge)) t.end() }) test(`execute correctly if options object were passed`, (t) => { const arrayToMerge = [{ example: true }, { another: `123` }] - t.doesNotThrow(mergeAll.bind(null, arrayToMerge, { clone: true })) + t.doesNotThrow(deepmergeAll.bind(null, arrayToMerge, { clone: true })) t.end() }) @@ -37,7 +37,7 @@ test(`invoke merge on every item in array should result with all props`, (t) => const thirdObject = { third: 123 } const fourthObject = { fourth: `some string` } - const mergedObject = mergeAll([ firstObject, secondObject, thirdObject, fourthObject ]) + const mergedObject = deepmergeAll([ firstObject, secondObject, thirdObject, fourthObject ]) t.ok(mergedObject.first === true) t.ok(mergedObject.second === false) @@ -51,7 +51,7 @@ test(`invoke merge on every item in array with clone should clone all elements`, const secondObject = { b: { e: true } } const thirdObject = { c: { f: `string` } } - const mergedWithClone = mergeAll([ firstObject, secondObject, thirdObject ], { clone: true }) + const mergedWithClone = deepmergeAll([ firstObject, secondObject, thirdObject ], { clone: true }) t.notEqual(mergedWithClone.a, firstObject.a) t.notEqual(mergedWithClone.b, secondObject.b) @@ -65,7 +65,7 @@ test(`invoke merge on every item in array with clone=false should not clone all const secondObject = { b: { e: true } } const thirdObject = { c: { f: `string` } } - const mergedWithoutClone = mergeAll([ firstObject, secondObject, thirdObject ], { clone: false }) + const mergedWithoutClone = deepmergeAll([ firstObject, secondObject, thirdObject ], { clone: false }) t.equal(mergedWithoutClone.a, firstObject.a) t.equal(mergedWithoutClone.b, secondObject.b) @@ -79,7 +79,7 @@ test(`invoke merge on every item in array with clone=true should clone all eleme const secondObject = { b: { e: true } } const thirdObject = { c: { f: `string` } } - const mergedWithoutClone = mergeAll([ firstObject, secondObject, thirdObject ], { clone: true }) + const mergedWithoutClone = deepmergeAll([ firstObject, secondObject, thirdObject ], { clone: true }) t.notEqual(mergedWithoutClone.a, firstObject.a) t.notEqual(mergedWithoutClone.b, secondObject.b) diff --git a/test/merge-plain-objects.ts b/test/merge-plain-objects.ts index 0efd771..1254cbf 100644 --- a/test/merge-plain-objects.ts +++ b/test/merge-plain-objects.ts @@ -1,4 +1,4 @@ -import { deepmerge as merge } from "deepmerge" +import { deepmerge } from "deepmerge" import test from "tape" test(`plain objects are merged by default`, (t) => { @@ -6,7 +6,7 @@ test(`plain objects are merged by default`, (t) => { newObject: new Object(), objectLiteral: { a: 123 }, } - const output = merge({}, input, { clone: false }) + const output = deepmerge({}, input, { clone: false }) t.deepEqual(output.newObject, input.newObject) t.equal(output.newObject, input.newObject) @@ -22,7 +22,7 @@ test(`instantiated objects are copied by reference`, (t) => { error: new Error(), regex: /regex/, } - const output = merge({}, input) + const output = deepmerge({}, input) t.equal(output.date, input.date) t.equal(output.error, input.error) diff --git a/test/merge.ts b/test/merge.ts index 3b1bd36..1c1dba0 100644 --- a/test/merge.ts +++ b/test/merge.ts @@ -1,12 +1,12 @@ import type { Options } from "deepmerge" -import { deepmerge as merge } from "deepmerge" +import { deepmerge } from "deepmerge" import test from "tape" test(`add keys in target that do not exist at the root`, (t) => { const src = { key1: `value1`, key2: `value2` } const target = {} - const res = merge(target, src) + const res = deepmerge(target, src) t.deepEqual(target, {}, `merge should be immutable`) t.deepEqual(res, src) @@ -24,7 +24,7 @@ test(`merge existing simple keys in target at the roots`, (t) => { } t.deepEqual(target, { key1: `value1`, key3: `value3` }) - t.deepEqual(merge(target, src), expected) + t.deepEqual(deepmerge(target, src), expected) t.end() }) @@ -56,7 +56,7 @@ test(`merge nested objects into target`, (t) => { subkey2: `value2`, }, }) - t.deepEqual(merge(target, src), expected) + t.deepEqual(deepmerge(target, src), expected) t.end() }) @@ -80,8 +80,8 @@ test(`replace simple key with nested object in target`, (t) => { key2: `value2`, } - t.deepEqual(merge(target, src, { clone: true }), expected) - t.deepEqual(merge(target, src, { clone: false }), expected) + t.deepEqual(deepmerge(target, src, { clone: true }), expected) + t.deepEqual(deepmerge(target, src, { clone: false }), expected) t.end() }) @@ -103,7 +103,7 @@ test(`should add nested object in target`, (t) => { }, } - t.deepEqual(merge(target, src), expected) + t.deepEqual(deepmerge(target, src), expected) t.end() }) @@ -129,7 +129,7 @@ test(`should clone source and target`, (t) => { }, } - const merged = merge(target, src, { clone: true }) + const merged = deepmerge(target, src, { clone: true }) t.deepEqual(merged, expected) @@ -152,7 +152,7 @@ test(`should clone source and target if specified`, (t) => { }, } - const merged = merge(target, src, { clone: true }) + const merged = deepmerge(target, src, { clone: true }) t.notEqual(merged.a, target.a) t.notEqual(merged.b, src.b) @@ -178,7 +178,7 @@ test(`should replace object with simple key in target`, (t) => { }, key2: `value2`, }) - t.deepEqual(merge(target, src), expected) + t.deepEqual(deepmerge(target, src), expected) t.end() }) @@ -189,7 +189,7 @@ test(`should replace objects with arrays`, (t) => { const expected = { key1: [ `subkey` ] } - t.deepEqual(merge(target, src), expected) + t.deepEqual(deepmerge(target, src), expected) t.end() }) @@ -200,7 +200,7 @@ test(`should replace arrays with objects`, (t) => { const expected = { key1: { subkey: `one` } } - t.deepEqual(merge(target, src), expected) + t.deepEqual(deepmerge(target, src), expected) t.end() }) @@ -211,7 +211,7 @@ test(`should replace dates with arrays`, (t) => { const expected = { key1: [ `subkey` ] } - t.deepEqual(merge(target, src), expected) + t.deepEqual(deepmerge(target, src), expected) t.end() }) @@ -228,7 +228,7 @@ test(`should replace null with arrays`, (t) => { key1: [ `subkey` ], } - t.deepEqual(merge(target, src), expected) + t.deepEqual(deepmerge(target, src), expected) t.end() }) @@ -238,8 +238,8 @@ test(`should work on simple array`, (t) => { const expected = [ `one`, `two`, `one`, `three` ] - t.deepEqual(merge(target, src), expected) - t.ok(Array.isArray(merge(target, src))) + t.deepEqual(deepmerge(target, src), expected) + t.ok(Array.isArray(deepmerge(target, src))) t.end() }) @@ -249,8 +249,8 @@ test(`should work on another simple array`, (t) => { const expected = [ `a1`, `a2`, `c1`, `f1`, `p1`, `t1`, `s1`, `c2`, `r1`, `p2`, `p3` ] t.deepEqual(target, [ `a1`, `a2`, `c1`, `f1`, `p1` ]) - t.deepEqual(merge(target, src), expected) - t.ok(Array.isArray(merge(target, src))) + t.deepEqual(deepmerge(target, src), expected) + t.ok(Array.isArray(deepmerge(target, src))) t.end() }) @@ -268,9 +268,9 @@ test(`should work on array properties`, (t) => { key2: [ `four` ], } - t.deepEqual(merge(target, src), expected) - t.ok(Array.isArray(merge(target, src).key1)) - t.ok(Array.isArray(merge(target, src).key2)) + t.deepEqual(deepmerge(target, src), expected) + t.ok(Array.isArray(deepmerge(target, src).key1)) + t.ok(Array.isArray(deepmerge(target, src).key2)) t.end() }) @@ -286,7 +286,7 @@ test(`should work on array properties with clone option`, (t) => { t.deepEqual(target, { key1: [ `one`, `two` ], }) - const merged = merge(target, src, { clone: true }) + const merged = deepmerge(target, src, { clone: true }) t.notEqual(merged.key1, src.key1) t.notEqual(merged.key1, target.key1) t.notEqual(merged.key2, src.key2) @@ -310,9 +310,9 @@ test(`should work on array of objects`, (t) => { { key3: [ `five` ] }, ] - t.deepEqual(merge(target, src), expected) - t.ok(Array.isArray(merge(target, src)), `result should be an array`) - t.ok(Array.isArray(merge(target, src)[0].key1), `subkey should be an array too`) + t.deepEqual(deepmerge(target, src), expected) + t.ok(Array.isArray(deepmerge(target, src)), `result should be an array`) + t.ok(Array.isArray(deepmerge(target, src)[0].key1), `subkey should be an array too`) t.end() }) @@ -334,10 +334,10 @@ test(`should work on array of objects with clone option`, (t) => { { key3: [ `five` ] }, ] - const merged = merge(target, src, { clone: true }) + const merged = deepmerge(target, src, { clone: true }) t.deepEqual(merged, expected) - t.ok(Array.isArray(merge(target, src)), `result should be an array`) - t.ok(Array.isArray(merge(target, src)[0].key1), `subkey should be an array too`) + t.ok(Array.isArray(deepmerge(target, src)), `result should be an array`) + t.ok(Array.isArray(deepmerge(target, src)[0].key1), `subkey should be an array too`) t.notEqual(merged[0].key1, src[0].key1) t.notEqual(merged[0].key1, target[0].key1) t.false(Object.prototype.hasOwnProperty.call(merged[0], `key2`), `"key2" should not exist on "merged[0]"`) @@ -351,8 +351,8 @@ test(`should treat regular expressions like primitive values`, (t) => { const src = { key1: /efg/ } const expected = { key1: /efg/ } - t.deepEqual(merge(target, src), expected) - t.deepEqual(merge(target, src).key1.test(`efg`), true) + t.deepEqual(deepmerge(target, src), expected) + t.deepEqual(deepmerge(target, src).key1.test(`efg`), true) t.end() }) @@ -361,7 +361,7 @@ test(`should treat regular expressions like primitive values and should not` const target = { key1: /abc/ } const src = { key1: /efg/ } - const output = merge(target, src, { clone: true }) + const output = deepmerge(target, src, { clone: true }) t.equal(output.key1, src.key1) t.end() @@ -382,7 +382,7 @@ test(`should treat dates like primitives`, (t) => { const expected = { key: tuesday, } - const actual = merge(target, source) + const actual = deepmerge(target, source) t.deepEqual(actual, expected) t.equal(actual.key.valueOf(), tuesday.valueOf()) @@ -401,7 +401,7 @@ test(`should treat dates like primitives and should not clone even with clone` key: tuesday, } - const actual = merge(target, source, { clone: true }) + const actual = deepmerge(target, source, { clone: true }) t.equal(actual.key, tuesday) t.end() @@ -414,7 +414,7 @@ test(`should work on array with null in it`, (t) => { const expected = [ null ] - t.deepEqual(merge(target, src), expected) + t.deepEqual(deepmerge(target, src), expected) t.end() }) @@ -423,7 +423,7 @@ test(`should clone array's element if it is object`, (t) => { const target = [] const source = [ a ] - const output = merge(target, source, { clone: true }) + const output = deepmerge(target, source, { clone: true }) t.notEqual(output[0], a) t.equal(output[0].key, `yup`) @@ -434,7 +434,7 @@ test(`should clone an array property when there is no target array`, (t) => { const someObject = {} const target = {} const source = { ary: [ someObject ] } - const output = merge(target, source, { clone: true }) + const output = deepmerge(target, source, { clone: true }) t.deepEqual(output, { ary: [{}] }) t.notEqual(output.ary[0], someObject) @@ -453,9 +453,9 @@ test(`should overwrite values when property is initialised but undefined`, (t) = t.equal(typeof o.value, `undefined`) } - hasUndefinedProperty(merge(target1, src)) - hasUndefinedProperty(merge(target2, src)) - hasUndefinedProperty(merge(target3, src)) + hasUndefinedProperty(deepmerge(target1, src)) + hasUndefinedProperty(deepmerge(target2, src)) + hasUndefinedProperty(deepmerge(target3, src)) t.end() }) @@ -468,7 +468,7 @@ test(`dates should copy correctly in an array`, (t) => { const source = [ tuesday, `lol` ] const expected = [ monday, `dude`, tuesday, `lol` ] - const actual = merge(target, source) + const actual = deepmerge(target, source) t.deepEqual(actual, expected) t.end() @@ -513,7 +513,7 @@ test(`should handle custom merge functions`, (t) => { return mergePeople } - return merge + return deepmerge }, } @@ -526,7 +526,7 @@ test(`should handle custom merge functions`, (t) => { }, } - const actual = merge(target, source, options) + const actual = deepmerge(target, source, options) t.deepEqual(actual, expected) t.end() }) @@ -569,7 +569,7 @@ test(`should handle custom merge functions`, (t) => { }, } - const actual = merge(target, source, options) + const actual = deepmerge(target, source, options) t.deepEqual(actual, expected) t.end() }) @@ -601,7 +601,7 @@ test(`should merge correctly if custom merge is not a valid function`, (t) => { }, } - const actual = merge(target, source) + const actual = deepmerge(target, source) t.deepEqual(actual, expected) t.end() }) @@ -611,7 +611,7 @@ test(`copy symbol keys in target that do not exist on the target`, (t) => { const src = { [mySymbol]: `value1` } const target = {} - const res = merge(target, src) + const res = deepmerge(target, src) t.equal(res[mySymbol], `value1`) t.deepEqual(Object.getOwnPropertySymbols(res), Object.getOwnPropertySymbols(src)) @@ -623,7 +623,7 @@ test(`copy symbol keys in target that do exist on the target`, (t) => { const src = { [mySymbol]: `value1` } const target = { [mySymbol]: `wat` } - const res = merge(target, src) + const res = deepmerge(target, src) t.equal(res[mySymbol as unknown as string], `value1`) t.end() @@ -632,7 +632,7 @@ test(`copy symbol keys in target that do exist on the target`, (t) => { test(`should not mutate options`, (t) => { const options: Options = {} - merge({}, {}, options) + deepmerge({}, {}, options) t.deepEqual(options, {}) t.end() @@ -651,7 +651,7 @@ test(`Falsey properties should be mergeable`, (t) => { let customMergeWasCalled = false - const result = merge(target, source, { + const result = deepmerge(target, source, { isMergeable() { return true }, diff --git a/test/prototype-poisoning.ts b/test/prototype-poisoning.ts index cd1379c..49d4313 100644 --- a/test/prototype-poisoning.ts +++ b/test/prototype-poisoning.ts @@ -1,12 +1,12 @@ import type { Options } from "deepmerge" -import { deepmerge as merge } from "deepmerge" +import { deepmerge } from "deepmerge" import isPlainObj from "is-plain-obj" import test from "tape" test(`merging objects with own __proto__`, (t) => { const user = {} const malicious = JSON.parse(`{ "__proto__": { "admin": true } }`) - const mergedObject = merge(user, malicious) + const mergedObject = deepmerge(user, malicious) t.notOk(mergedObject.__proto__.admin, `non-plain properties should not be merged`) t.notOk(mergedObject.admin, `the destination should have an unmodified prototype`) t.end() @@ -29,7 +29,7 @@ test(`merging objects with plain and non-plain properties`, (t) => { [plainSymbolKey]: `qux`, } - const mergedObject = merge(target, source, { clone: true }) + const mergedObject = deepmerge(target, source, { clone: true }) t.equal(undefined, mergedObject.parentKey, `inherited properties of target should be removed, not merged or ignored`) t.equal(`bar`, mergedObject.plainKey, `enumerable own properties of target should be merged`) t.equal(`baz`, mergedObject.newKey, `properties not yet on target should be merged`) @@ -47,14 +47,14 @@ test(`merging strings works with a custom string merge`, (t) => { return target[0] + `. ` + source.substring(0, 3) } } else { - return merge + return deepmerge } } const mergeable: Options[`isMergeable`] = (target) => isPlainObj(target) || (typeof target === `string` && target.length > 1) - t.equal(`A. Ham`, merge(target, source, { customMerge, isMergeable: mergeable }).name) + t.equal(`A. Ham`, deepmerge(target, source, { customMerge, isMergeable: mergeable }).name) t.end() }) @@ -73,6 +73,6 @@ test(`merging objects with null prototype`, (t) => { }, } - t.deepEqual(merge(target, source, { clone: true }), expected) + t.deepEqual(deepmerge(target, source, { clone: true }), expected) t.end() }) From 254d50cf69383fd6556a8fe2e4af201e5cfbc213 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sun, 24 Jan 2021 01:59:54 +1300 Subject: [PATCH 21/22] docs: update readme --- readme.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/readme.md b/readme.md index 3375fb9..5b75135 100644 --- a/readme.md +++ b/readme.md @@ -4,13 +4,13 @@ Merges the enumerable properties of two or more objects deeply. > UMD bundle is 718B minified+gzipped -**As of version 5, ES5 is no longer supported** +**As of version 5, ES5 is no longer natively supported** ## Getting Started ### Example Usage ```js @@ -50,7 +50,7 @@ const output = { quux: 5 } -merge(x, y) // => output +deepmerge(x, y) // => output ``` @@ -67,10 +67,10 @@ deepmerge can be used directly in the browser without the use of package manager ### Include -deepmerge exposes a CommonJS entry point: +deepmerge exposes a CommonJS entry point containing two functions: ``` -const merge = require('deepmerge') +const { deepmerge, deepmergeAll } = require('deepmerge') ``` The ESM entry point was dropped due to a [Webpack bug](https://github.com/webpack/webpack/issues/6584). @@ -78,7 +78,7 @@ The ESM entry point was dropped due to a [Webpack bug](https://github.com/webpac # API -## `merge(x, y, [options])` +## `deepmerge(x, y, [options])` Merge two objects `x` and `y` deeply, returning a new merged object with the elements from both `x` and `y`. @@ -90,7 +90,7 @@ Merging creates a new object, so that neither `x` or `y` is modified. **Note:** By default, arrays are merged by concatenating them. -## `mergeAll(arrayOfObjects, [options])` +## `deepmergeAll(arrayOfObjects, [options])` Merges any number of objects into a single result object. @@ -99,7 +99,7 @@ const foobar = { foo: { bar: 3 } } const foobaz = { foo: { baz: 4 } } const bar = { bar: 'yay!' } -mergeAll([ foobar, foobaz, bar ]) // => { foo: { bar: 3, baz: 4 }, bar: 'yay!' } +deepmergeAll([ foobar, foobaz, bar ]) // => { foo: { bar: 3, baz: 4 }, bar: 'yay!' } ``` @@ -121,7 +121,7 @@ Overwrites the existing array values completely rather than concatenating them: ```js const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray -merge( +deepmerge( [1, 2, 3], [3, 2, 1], { arrayMerge: overwriteMerge } @@ -142,7 +142,7 @@ const combineMerge = (target, source, options) => { if (typeof destination[index] === 'undefined') { destination[index] = options.cloneUnlessOtherwiseSpecified(item, options) } else if (options.isMergeable(item)) { - destination[index] = merge(target[index], item, options) + destination[index] = deepmerge(target[index], item, options) } else if (target.indexOf(item) === -1) { destination.push(item) } @@ -150,7 +150,7 @@ const combineMerge = (target, source, options) => { return destination } -merge( +deepmerge( [{ a: true }], [{ b: true }, 'ah yup'], { arrayMerge: combineMerge } @@ -190,13 +190,13 @@ const source = { someProperty: instantiatedSpecialObject } -const defaultOutput = merge(target, source) +const defaultOutput = deepmerge(target, source) defaultOutput.someProperty.cool // => undefined defaultOutput.someProperty.special // => 'oh yeah man totally' defaultOutput.someProperty instanceof SuperSpecial // => true -const customMergeOutput = merge(target, source, { +const customMergeOutput = deepmerge(target, source, { isMergeable: mergeEverything }) @@ -240,7 +240,7 @@ const options = { } } -const result = merge(alex, tony, options) +const result = deepmerge(alex, tony, options) result.name // => 'Alex and Tony' result.pets // => ['Cat', 'Parrot', 'Dog'] @@ -249,9 +249,9 @@ result.pets // => ['Cat', 'Parrot', 'Dog'] ### `clone` -Defaults to `true`. +Defaults to `false`. -If `clone` is `false` then child properties will be copied directly onto targets without cloning the target. +If `clone` is `true` then no deeply nested mergable object in the inputs will be in the resulting value. # Testing From 0b9c421c860662590c89e694427f4ea25f48fc3c Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sun, 24 Jan 2021 02:15:10 +1300 Subject: [PATCH 22/22] build: set up js linting --- .eslintrc.json | 211 +++++++++ .github/workflows/ci.yml | 35 +- package-lock.json | 972 +++++++++++++++++++++++++++++++++++++++ package.json | 5 + 4 files changed, 1206 insertions(+), 17 deletions(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..0735f44 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,211 @@ +{ + "root": true, + "parserOptions": { + "ecmaVersion": 10, + "ecmaFeatures": { + "impliedStrict": true + }, + "sourceType": "module" + }, + "env": { + "browser": true, + "es6": true, + "node": true + }, + "extends": [ + "eslint:recommended" + ], + "ignorePatterns": ["dist", "types"], + "rules": { + "no-extra-boolean-cast": "error", + "array-bracket-spacing": [ + "error", + "always", + { + "objectsInArrays": false + } + ], + "block-spacing": ["error", "always"], + "brace-style": "error", + "comma-dangle": ["error", "always-multiline"], + "comma-spacing": [ + "error", + { + "before": false, + "after": true + } + ], + "comma-style": "error", + "curly": "error", + "computed-property-spacing": ["error", "never"], + "func-call-spacing": ["error", "never"], + "indent": ["error", "tab"], + "key-spacing": "error", + "keyword-spacing": "error", + "no-whitespace-before-property": "error", + "no-trailing-spaces": "error", + "object-curly-spacing": ["error", "always"], + "padded-blocks": ["error", "never"], + "semi": ["error", "never"], + "space-before-function-paren": ["error", "never"], + "space-in-parens": ["error", "never"], + "space-infix-ops": "error", + "space-unary-ops": [ + "error", + { + "words": true, + "nonwords": false + } + ], + "no-regex-spaces": "error", + "no-unsafe-negation": "error", + "dot-location": ["error", "property"], + "dot-notation": "error", + "no-extra-label": "error", + "no-multi-spaces": [ + "error", + { + "exceptions": { + "Property": false + } + } + ], + "no-useless-return": "error", + "eol-last": ["error", "always"], + "linebreak-style": "error", + "no-lonely-if": "error", + "no-unneeded-ternary": "error", + "object-curly-newline": [ + "error", + { + "consistent": true + } + ], + "operator-linebreak": ["error", "before"], + "quote-props": ["error", "as-needed"], + "quotes": ["error", "backtick"], + "space-before-blocks": ["error", "always"], + "spaced-comment": ["error", "always"], + "template-tag-spacing": "error", + "unicode-bom": "error", + "arrow-body-style": ["error", "as-needed"], + "arrow-parens": ["error", "always"], + "arrow-spacing": "error", + "generator-star-spacing": "error", + "no-useless-computed-key": "error", + "no-useless-rename": "error", + "no-var": "error", + "object-shorthand": "error", + "prefer-arrow-callback": [ + "error", + { + "allowNamedFunctions": true + } + ], + "prefer-const": "error", + "prefer-numeric-literals": "error", + "prefer-spread": "error", + "rest-spread-spacing": "error", + "template-curly-spacing": ["error", "always"], + + "no-bitwise": "error", + "no-console": "off", + "no-debugger": "off", + "no-empty": "error", + "no-inner-declarations": "off", + "no-undef": "error", + "no-unused-vars": "warn" + }, + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": [ + "./tsconfig.base.json", + "./tsconfig.json", + "./tsconfig.typedef.json", + "./test/tsconfig.json" + ] + }, + "plugins": [ + "@typescript-eslint" + ], + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "types": { + "Object": { + "message": "Use object instead", + "fixWith": "object" + }, + "object": false, + "{}": false + }, + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-imports": "error", + "@typescript-eslint/prefer-interface": "off", + "@typescript-eslint/no-require-imports": "error", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-unused-vars-experimental": [ + "warn", + { + "ignoredNamesRegex": "^_", + "ignoreArgsIfArgsAfterAreUsed": true + } + ], + "@typescript-eslint/no-use-before-define": [ + "error", + { + "functions": false, + "variables": true + } + ], + + "@typescript-eslint/prefer-for-of": "warn", + "@typescript-eslint/prefer-includes": "warn", + "@typescript-eslint/prefer-nullish-coalescing": "warn", + "@typescript-eslint/prefer-optional-chain": "warn", + "@typescript-eslint/prefer-string-starts-ends-with": "warn", + "@typescript-eslint/prefer-ts-expect-error": "warn", + "@typescript-eslint/switch-exhaustiveness-check": "warn", + "@typescript-eslint/unified-signatures": "warn", + + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-return": "off" + } + }, + { + "files": [ + "**/test/**/*", + "**/*test.ts" + ], + "rules": { + "no-unused-vars": "off", + + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/unbound-method": "off", + "@typescript-eslint/restrict-plus-operands": "off", + "@typescript-eslint/restrict-template-expressions": "off" + } + } + ] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9cc322..92c7a72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,23 +5,24 @@ on: - pull_request jobs: - # lint: - # name: Linting Checks - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v2 - - # - name: Setup NodeJs - # uses: actions/setup-node@v1 - # with: - # node-version: "14" - - # - name: Install Dependencies - # run: npm ci - - # - name: Run Linting Checks - # run: npm run lint + lint: + name: Linting Checks + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup NodeJs + uses: actions/setup-node@v1 + with: + node-version: "14" + + - name: Install Dependencies + run: npm ci + + - name: Run Linting Checks + run: npm run lint + test: strategy: fail-fast: true diff --git a/package-lock.json b/package-lock.json index a7a89eb..27a307f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,40 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "dev": true + }, + "@babel/highlight": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + } + } + }, "@definitelytyped/header-parser": { "version": "0.0.66", "resolved": "https://registry.npmjs.org/@definitelytyped/header-parser/-/header-parser-0.0.66.tgz", @@ -56,6 +90,64 @@ } } }, + "@eslint/eslintrc": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz", + "integrity": "sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "lodash": "^4.17.20", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + } + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.4", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.4", + "fastq": "^1.6.0" + } + }, "@rollup/plugin-commonjs": { "version": "16.0.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-16.0.0.tgz", @@ -191,6 +283,12 @@ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", "dev": true }, + "@types/json-schema": { + "version": "7.0.7", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", + "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==", + "dev": true + }, "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -218,6 +316,154 @@ "@types/node": "*" } }, + "@typescript-eslint/eslint-plugin": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.0.tgz", + "integrity": "sha512-IJ5e2W7uFNfg4qh9eHkHRUCbgZ8VKtGwD07kannJvM5t/GU8P8+24NX8gi3Hf5jST5oWPY8kyV1s/WtfiZ4+Ww==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "4.14.0", + "@typescript-eslint/scope-manager": "4.14.0", + "debug": "^4.1.1", + "functional-red-black-tree": "^1.0.1", + "lodash": "^4.17.15", + "regexpp": "^3.0.0", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "tsutils": { + "version": "3.19.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.19.1.tgz", + "integrity": "sha512-GEdoBf5XI324lu7ycad7s6laADfnAqCw6wLGI+knxvw9vsIYBaJfYdmeCEG3FMMUiSm3OGgNb+m6utsWf5h9Vw==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/experimental-utils": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.0.tgz", + "integrity": "sha512-6i6eAoiPlXMKRbXzvoQD5Yn9L7k9ezzGRvzC/x1V3650rUk3c3AOjQyGYyF9BDxQQDK2ElmKOZRD0CbtdkMzQQ==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/scope-manager": "4.14.0", + "@typescript-eslint/types": "4.14.0", + "@typescript-eslint/typescript-estree": "4.14.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.0.tgz", + "integrity": "sha512-sUDeuCjBU+ZF3Lzw0hphTyScmDDJ5QVkyE21pRoBo8iDl7WBtVFS+WDN3blY1CH3SBt7EmYCw6wfmJjF0l/uYg==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "4.14.0", + "@typescript-eslint/types": "4.14.0", + "@typescript-eslint/typescript-estree": "4.14.0", + "debug": "^4.1.1" + } + }, + "@typescript-eslint/scope-manager": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.0.tgz", + "integrity": "sha512-/J+LlRMdbPh4RdL4hfP1eCwHN5bAhFAGOTsvE6SxsrM/47XQiPSgF5MDgLyp/i9kbZV9Lx80DW0OpPkzL+uf8Q==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.14.0", + "@typescript-eslint/visitor-keys": "4.14.0" + } + }, + "@typescript-eslint/types": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.0.tgz", + "integrity": "sha512-VsQE4VvpldHrTFuVPY1ZnHn/Txw6cZGjL48e+iBxTi2ksa9DmebKjAeFmTVAYoSkTk7gjA7UqJ7pIsyifTsI4A==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.0.tgz", + "integrity": "sha512-wRjZ5qLao+bvS2F7pX4qi2oLcOONIB+ru8RGBieDptq/SudYwshveORwCVU4/yMAd4GK7Fsf8Uq1tjV838erag==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.14.0", + "@typescript-eslint/visitor-keys": "4.14.0", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "tsutils": { + "version": "3.19.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.19.1.tgz", + "integrity": "sha512-GEdoBf5XI324lu7ycad7s6laADfnAqCw6wLGI+knxvw9vsIYBaJfYdmeCEG3FMMUiSm3OGgNb+m6utsWf5h9Vw==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.0.tgz", + "integrity": "sha512-MeHHzUyRI50DuiPgV9+LxcM52FCJFYjJiWHtXlbyC27b80mfOwKeiKI+MHOTEpcpfmoPFm/vvQS88bYIx6PZTA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.14.0", + "eslint-visitor-keys": "^2.0.0" + } + }, + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "dev": true + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -230,6 +476,12 @@ "uri-js": "^4.2.2" } }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -284,6 +536,12 @@ "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", "dev": true }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -299,6 +557,12 @@ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -422,6 +686,15 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -460,6 +733,12 @@ "get-intrinsic": "^1.0.0" } }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -652,6 +931,17 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -661,6 +951,15 @@ "assert-plus": "^1.0.0" } }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", @@ -735,6 +1034,24 @@ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "dotignore": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz", @@ -817,6 +1134,15 @@ "once": "^1.4.0" } }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, "es-abstract": { "version": "1.18.0-next.1", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", @@ -891,12 +1217,245 @@ } } }, + "eslint": { + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.18.0.tgz", + "integrity": "sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@eslint/eslintrc": "^0.3.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.2.0", + "esutils": "^2.0.2", + "file-entry-cache": "^6.0.0", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash": "^4.17.20", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.4", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + } + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "dev": true + }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, "esprima": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", "dev": true }, + "esquery": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", + "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, "estraverse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", @@ -927,6 +1486,20 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -939,6 +1512,33 @@ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "fastq": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.10.0.tgz", + "integrity": "sha512-NL2Qc5L3iQEsyYzweq7qfgy5OtXCmGzGvhElGEd/SoFWEMOEczNh5s5ocaF01HDetxz+p8ecjNPA6cZxxIHmzA==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.0.tgz", + "integrity": "sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -949,6 +1549,33 @@ "path-exists": "^4.0.0" } }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "flatted": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", + "dev": true + }, "for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -1029,6 +1656,12 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "gauge": { "version": "2.7.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", @@ -1086,6 +1719,38 @@ "path-is-absolute": "^1.0.0" } }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "globby": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", + "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, "graceful-fs": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", @@ -1168,6 +1833,28 @@ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1223,6 +1910,12 @@ "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", "dev": true }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", @@ -1233,6 +1926,15 @@ "number-is-nan": "^1.0.0" } }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, "is-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.1.tgz", @@ -1257,6 +1959,12 @@ "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", "dev": true }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, "is-number-object": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz", @@ -1356,6 +2064,12 @@ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", "dev": true }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -1426,6 +2140,12 @@ "jsonify": "~0.0.0" } }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -1487,6 +2207,21 @@ "p-locate": "^4.1.0" } }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -1499,6 +2234,22 @@ "integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==", "dev": true }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, "mime-db": { "version": "1.45.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz", @@ -1538,6 +2289,18 @@ "minimist": "^1.2.5" } }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -1718,6 +2481,15 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parsimmon": { "version": "1.16.0", "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.16.0.tgz", @@ -1736,12 +2508,24 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, "path-parse": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -1766,6 +2550,12 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -1844,6 +2634,12 @@ } } }, + "regexpp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "dev": true + }, "request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -1878,6 +2674,12 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, "require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", @@ -1894,6 +2696,12 @@ "path-parse": "^1.0.6" } }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, "resumer": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", @@ -1909,6 +2717,12 @@ "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", "dev": true }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", @@ -1927,6 +2741,12 @@ "fsevents": "~2.1.2" } }, + "run-parallel": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.10.tgz", + "integrity": "sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw==", + "dev": true + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -1951,6 +2771,21 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, "side-channel": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.3.tgz", @@ -1968,6 +2803,31 @@ "dev": true, "optional": true }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + } + } + }, "slide": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", @@ -2146,6 +3006,70 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, + "table": { + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", + "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", + "dev": true, + "requires": { + "ajv": "^7.0.2", + "lodash": "^4.17.20", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0" + }, + "dependencies": { + "ajv": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.0.3.tgz", + "integrity": "sha512-R50QRlXSxqXcQP5SvKUrw8VZeypvo12i2IX0EeR5PiZ7bEKeHWgzgo264LDadUsCU42lTJVhFikTqJwNeH34gQ==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } + }, "tape": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/tape/-/tape-5.0.1.tgz", @@ -2235,6 +3159,12 @@ } } }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -2261,6 +3191,15 @@ } } }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, "tough-cookie": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", @@ -2384,6 +3323,12 @@ "prelude-ls": "~1.1.2" } }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -2428,6 +3373,12 @@ "from": "github:jkroso/v8-argv#1.1.1", "dev": true }, + "v8-compile-cache": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", + "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", + "dev": true + }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -2458,6 +3409,15 @@ "extsprintf": "^1.2.0" } }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, "which-boxed-primitive": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.1.tgz", @@ -2534,6 +3494,12 @@ "string-width": "^1.0.2 || 2" } }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -2597,6 +3563,12 @@ "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", "dev": true }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "yargs": { "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", diff --git a/package.json b/package.json index 21dba37..c2bb190 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,8 @@ "build": "npm run build:js && npm run build:types", "build:js": "rollup -c", "build:types": "tsc -p tsconfig.typedef.json", + "lint": "npm run lint:js", + "lint:js": "eslint .", "size": "npm run build && terser --compress --mangle -- ./dist/umd.js | gzip -c | wc -c", "test": "npm run test:js && npm run test:types && npm run test:jsmd", "test:js": "ts-node -C typescript -P test/tsconfig.json -r tsconfig-paths/register node_modules/tape/bin/tape test/*.ts", @@ -56,7 +58,10 @@ "@rollup/plugin-typescript": "^8.1.0", "@types/node": "^8.10.54", "@types/tape": "^4.13.0", + "@typescript-eslint/eslint-plugin": "^4.8.0", + "@typescript-eslint/parser": "^4.8.0", "dtslint": "^4.0.6", + "eslint": "^7.13.0", "is-mergeable-object": "1.1.0", "is-plain-obj": "^3.0.0", "jsmd": "^1.0.2",