From c5816342cb894aecbc4dc11ba301fa22c4eae4b2 Mon Sep 17 00:00:00 2001 From: Hunter Date: Fri, 29 May 2020 14:09:54 -0500 Subject: [PATCH 1/8] typed deepmerge --- index.d.ts | 20 ++++++++++++++++++-- package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/index.d.ts b/index.d.ts index 7412fcf..7bf9cde 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,21 @@ -declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T; -declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T1 & T2; +type ValueOfKey = K extends keyof T ? T[K] : never; +// Is object AND NOT ('never' or 'array') +type IsObject = [T] extends [never] ? false : T extends unknown[] ? false : [T] extends [object] ? true : false; +type ShouldMergeProps = IsObject extends false ? false : IsObject extends false ? false : true; +type DeepMerge = ShouldMergeProps extends true + ? { + [K in keyof T1 | keyof T2]: DeepMerge, ValueOfKey>; + } + : T1 | T2; + +/** +* ## JS Object Deep Merge +* look more info in https://github.com/TehShrike/deepmerge +* @param x the first obj +* @param y the second obj +* @param options deepmerge option +*/ +declare function deepmerge(x: T1, y: T2, options?: deepmerge.Options): DeepMerge declare namespace deepmerge { export interface Options { diff --git a/package-lock.json b/package-lock.json index c112ccb..b809bad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -328,7 +328,7 @@ "esprima": "^2.7.3", "estraverse": "^4.2.0", "marked": "^0.7.0", - "v8-argv": "github:jkroso/v8-argv#1.1.1" + "v8-argv": "github:jkroso/v8-argv#284f84379e292eb956a5e7b66fb953ec4974385e" } }, "levn": { @@ -644,9 +644,9 @@ } }, "typescript": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.2.2.tgz", - "integrity": "sha1-YGAiUIR5tV/6NotY/uljoD39eww=", + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", + "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index 99ed0d6..506e00a 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "rollup-plugin-node-resolve": "^5.2.0", "tape": "^4.11.0", "ts-node": "7.0.1", - "typescript": "=2.2.2", + "typescript": "^3.9.3", "uglify-js": "^3.6.1" }, "license": "MIT", From 8d9db627543ae2bd846e3c27ca18ddb1a328eb73 Mon Sep 17 00:00:00 2001 From: Hunter Date: Fri, 29 May 2020 14:22:15 -0500 Subject: [PATCH 2/8] typescript test --- test/typescript.ts | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/typescript.ts b/test/typescript.ts index 23d2c5c..489cc3d 100644 --- a/test/typescript.ts +++ b/test/typescript.ts @@ -63,3 +63,51 @@ merged2 = merge(x, z, options2); merged3 = merge.all<{wat: number}>([x, y, z], options1); const merged4 = merge(x, y, options3); + +const t1 = { + key1: 'key1-val', + key2: { + key2key1: [false, 'true'] + }, + key3: { + key3key1: { + key3key1key1: 'key3key1key1-val', + key3key1key2: true, + key3key1key3: ['key3key1key3-val'] + }, + key3key2: ['key3key2-val'] + } +}; + +const t2 = { + key1: ['key1-val'], + key2: { + key2key1: { + key2key1key1: () => 'key2key1key1-val', + key2key1key2: true, + key2key1key3: ['key2key1key3-val'] + } + }, + key3: { + key3key1: () => false, + key3key2: ['key3key2-val', true] + } +}; + +const merged5: { + key1: string | string[]; + key2: { + key2key1: (string | boolean)[] | { + key2key1key1: () => string; + key2key1key2: boolean; + key2key1key3: string[]; + }; + }; + key3: { + key3key1: { + key3key1key1: string;key3key1key2: boolean; + key3key1key3: string[]; + }; + key3key2: (string | boolean)[] | string[]; + }; +} = merge(t1, t2); From 22a14fb1bce842902b4bd03a9ebb777b366d725b Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Tue, 10 Nov 2020 14:44:09 +1300 Subject: [PATCH 3/8] chore: move types declaration 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 506e00a..2e9675e 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "url": "git://github.com/TehShrike/deepmerge.git" }, "main": "dist/cjs.js", + "types": "types", "engines": { "node": ">=0.10.0" }, 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 4d2c1a731679b9e8fc1f5016a5433e7e2e2f7f23 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Tue, 10 Nov 2020 14:46:34 +1300 Subject: [PATCH 4/8] test: set up dtslint for testing typescript types recreate type tests --- package-lock.json | 1602 ++++++++++++++++++++++++++++++++++++++++++- package.json | 3 +- test/typescript.ts | 113 --- types/test.ts | 181 +++++ types/tsconfig.json | 11 + 5 files changed, 1773 insertions(+), 137 deletions(-) delete mode 100644 test/typescript.ts create mode 100644 types/test.ts create mode 100644 types/tsconfig.json diff --git a/package-lock.json b/package-lock.json index b809bad..5ac4ded 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,58 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@definitelytyped/header-parser": { + "version": "0.0.59", + "resolved": "https://registry.npmjs.org/@definitelytyped/header-parser/-/header-parser-0.0.59.tgz", + "integrity": "sha512-Y0Hoi+I0tD1xRNYUlt9dpZ2sykPoNAsS/nVtyaGJDYhVg0Q3U4U8afAOFlK3Fro2MfdM+1Kxc7DeaabaUeFmYw==", + "dev": true, + "requires": { + "@definitelytyped/typescript-versions": "^0.0.59", + "@types/parsimmon": "^1.10.1", + "parsimmon": "^1.13.0" + } + }, + "@definitelytyped/typescript-versions": { + "version": "0.0.59", + "resolved": "https://registry.npmjs.org/@definitelytyped/typescript-versions/-/typescript-versions-0.0.59.tgz", + "integrity": "sha512-R3DNeeNDK4l55OD28cNsvtmzz6K71O7XMf6Xd/BR45mfqn2wZUovghGMV3iCs9B3z2OsdhXqRnjX2Hhnj8NKJA==", + "dev": true + }, + "@definitelytyped/utils": { + "version": "0.0.59", + "resolved": "https://registry.npmjs.org/@definitelytyped/utils/-/utils-0.0.59.tgz", + "integrity": "sha512-Jmv9mfGGGdCqOgNTGQQxvx3NRu5OfIb51AsVJXX5u2eJz/PzlONTExNlp5T0TwVN3SDtHxFDoFUG0A/pFGmElA==", + "dev": true, + "requires": { + "@definitelytyped/typescript-versions": "^0.0.59", + "@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.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.4.tgz", + "integrity": "sha512-o3oj1bETk8kBwzz1WlO6JWL/AfAA3Vm6J1B3C9CsdxHYp7XgPiH7OEXPUbZTndHlRaIElrANkQfe6ZmfJb3H2w==", + "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" + } + } + } + }, "@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", @@ -16,6 +68,12 @@ "integrity": "sha512-kaYyLYf6ICn6/isAyD4K1MyWWd5Q3JgH6bnMN089LUx88+s4W8GvK9Q6JMBVu5vsFFp7pMdSxdKmlBXwH/VFRg==", "dev": true }, + "@types/parsimmon": { + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/@types/parsimmon/-/parsimmon-1.10.4.tgz", + "integrity": "sha512-M56NfQHfaWuaj6daSgCVs7jh8fXLI3LmxjRoQxmOvYesgIkI+9HPsDLO0vd7wX7cwA0D0ZWFEJdp0VPwLdS+bQ==", + "dev": true + }, "@types/resolve": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", @@ -31,18 +89,185 @@ "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", "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" + } + }, + "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" + } + }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "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 + }, + "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.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", + "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", @@ -53,6 +278,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", @@ -65,6 +300,161 @@ "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 + }, + "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.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", @@ -77,6 +467,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": "1.0.1", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", @@ -104,6 +534,98 @@ "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": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "dts-critic": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/dts-critic/-/dts-critic-3.3.3.tgz", + "integrity": "sha512-Pd27sNICo8mUqZ7XBdefy/+eWG8uG02GaYgOv5DBpxiF+8hduojztVm4935dqocyDv/STdF1uh6a8WnAhBK7tQ==", + "dev": true, + "requires": { + "@definitelytyped/header-parser": "^0.0.59", + "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.5", + "resolved": "https://registry.npmjs.org/dtslint/-/dtslint-4.0.5.tgz", + "integrity": "sha512-gEf7tEQgdMQh38h29B2aVyJBGMb8l/5koVArmc4t3XyeCe0rbElpB0HjOZ6SgUOzvsI05hTOenY66aM9ji3afA==", + "dev": true, + "requires": { + "@definitelytyped/header-parser": "^0.0.59", + "@definitelytyped/typescript-versions": "^0.0.59", + "@definitelytyped/utils": "^0.0.59", + "dts-critic": "^3.3.3", + "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.15.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.15.0.tgz", @@ -133,6 +655,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", @@ -178,12 +706,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", @@ -193,18 +755,96 @@ "is-callable": "^1.1.3" } }, + "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", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": 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 + }, + "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.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -219,6 +859,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", @@ -228,12 +890,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.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", "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", @@ -262,6 +969,16 @@ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", "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-mergeable-object": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-mergeable-object/-/is-mergeable-object-1.1.0.tgz", @@ -318,6 +1035,54 @@ "has-symbols": "^1.0.0" } }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "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.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "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", @@ -328,7 +1093,61 @@ "esprima": "^2.7.3", "estraverse": "^4.2.0", "marked": "^0.7.0", - "v8-argv": "github:jkroso/v8-argv#284f84379e292eb956a5e7b66fb953ec4974385e" + "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": { @@ -341,6 +1160,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" + } + }, "magic-string": { "version": "0.25.4", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.4.tgz", @@ -362,6 +1190,21 @@ "integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==", "dev": true }, + "mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "dev": true + }, + "mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dev": true, + "requires": { + "mime-db": "1.44.0" + } + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -371,28 +1214,105 @@ "brace-expansion": "^1.1.7" } }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "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 }, - "mkdirp": { - "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "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, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } + "optional": true }, "object-inspect": { "version": "1.6.0", @@ -429,6 +1349,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", @@ -441,12 +1419,105 @@ "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 + }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "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": { + "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 + } + } + }, + "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.12.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", @@ -465,6 +1536,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": "1.23.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.23.1.tgz", @@ -511,6 +1597,43 @@ "estree-walker": "^0.6.1" } }, + "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 + }, + "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", @@ -541,6 +1664,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.6", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.6.tgz", + "integrity": "sha512-+orQK83kyMva3WyPf59k1+Y525csj5JejicWut55zeTWANuN17qSiSLUXWtzHeNWORSvT7GLDJ/E/XiIWoXBTw==", + "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.1.2", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz", @@ -572,6 +1771,44 @@ "function-bind": "^1.1.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": "4.11.0", "resolved": "https://registry.npmjs.org/tape/-/tape-4.11.0.tgz", @@ -604,12 +1841,79 @@ } } }, + "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.1.4", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.4.tgz", + "integrity": "sha512-o3pS2zlG4gxr67GmFYBLlq+dM8gyRGUOvsrHclSkvtVtQbjV0s/+ZE8OpICbaj8clrX3tjeHngYGP7rweaBnuw==", + "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" + } + } + } + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "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": "7.0.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz", @@ -634,6 +1938,65 @@ } } }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "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 + } + } + }, + "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" + } + }, + "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", @@ -643,10 +2006,16 @@ "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": "3.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", - "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==", + "version": "3.9.7", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", + "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", "dev": true }, "uglify-js": { @@ -659,23 +2028,210 @@ "source-map": "~0.6.1" } }, + "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.0", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", + "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "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-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "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.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "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": "2.0.0", "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", diff --git a/package.json b/package.json index 2e9675e..78e4945 100644 --- a/package.json +++ b/package.json @@ -23,11 +23,12 @@ "scripts": { "build": "rollup -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", + "test:typescript": "dtslint --expectOnly types", "size": "npm run build && uglifyjs --compress --mangle -- ./dist/umd.js | gzip -c | wc -c" }, "devDependencies": { "@types/node": "^8.10.54", + "dtslint": "^4.0.5", "is-mergeable-object": "1.1.0", "is-plain-object": "^2.0.4", "jsmd": "^1.0.2", diff --git a/test/typescript.ts b/test/typescript.ts deleted file mode 100644 index 489cc3d..0000000 --- a/test/typescript.ts +++ /dev/null @@ -1,113 +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, - isMergeableObject (obj) { - return false; - }, -}; - -const options2: merge.Options = { - arrayMerge (target, source, options) { - target.length; - source.length; - options.isMergeableObject(target); - - return []; - }, - clone: true, - isMergeableObject (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); - -const t1 = { - key1: 'key1-val', - key2: { - key2key1: [false, 'true'] - }, - key3: { - key3key1: { - key3key1key1: 'key3key1key1-val', - key3key1key2: true, - key3key1key3: ['key3key1key3-val'] - }, - key3key2: ['key3key2-val'] - } -}; - -const t2 = { - key1: ['key1-val'], - key2: { - key2key1: { - key2key1key1: () => 'key2key1key1-val', - key2key1key2: true, - key2key1key3: ['key2key1key3-val'] - } - }, - key3: { - key3key1: () => false, - key3key2: ['key3key2-val', true] - } -}; - -const merged5: { - key1: string | string[]; - key2: { - key2key1: (string | boolean)[] | { - key2key1key1: () => string; - key2key1key2: boolean; - key2key1key3: string[]; - }; - }; - key3: { - key3key1: { - key3key1key1: string;key3key1key2: boolean; - key3key1key3: string[]; - }; - key3key2: (string | boolean)[] | string[]; - }; -} = merge(t1, t2); diff --git a/types/test.ts b/types/test.ts new file mode 100644 index 0000000..ced093e --- /dev/null +++ b/types/test.ts @@ -0,0 +1,181 @@ +import deepmerge 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; } +deepmerge.all([a, b]); + +interface 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 +deepmerge.all([a as T, b as T]); + +interface U { + bar?: string; +} + +// FIXME: The type should really be: { foo: string; bar?: string; } +// $ExpectType { foo: string; bar?: string | undefined; } +deepmerge(a as T, b as U); +// $ExpectType { foo: string; bar?: string | undefined; } +deepmerge.all([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"; } +deepmerge.all([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; } +deepmerge.all([b, c]); + +// $ExpectType { foo: string; baz: { quuz: string[]; corge: number; }; garply: 42; grault: number; bar: "123"; quux: "456"; } +deepmerge.all([a, b, c]); + +// Allow abatort arrays of objects to be passes even if we can't determine anything about the result. +const abc = [a, b, c]; +// $ExpectType object +deepmerge.all(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; } +deepmerge.all([c, d]); + +type E = { readonly foo: readonly number[] }; +type F = { readonly foo: readonly string[] }; + +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"]; } +deepmerge.all([e, f]); + +// $ExpectType { foo: (string | number)[]; } +deepmerge(e as E, f as F); +// $ExpectType { foo: (string | number)[]; } +deepmerge.all([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)[]; }; } +deepmerge.all([g, h]); + +// $ExpectType { foo: string; baz: unknown; garply: number; grault: number; } +deepmerge(a, b, { + isMergeableObject: (obj: object) => { + return false; + }, +}); +// $ExpectType { foo: string; baz: unknown; garply: number; grault: number; } +deepmerge.all([a, b], { + isMergeableObject: (obj: object) => { + return false; + }, +}); + +const i = { + baz: { + quuz: [5, 6], + }, +}; + +// $ExpectType { foo: string; baz: { quuz: number; }; garply: number; } +deepmerge(a, i, { + arrayMerge: (target: unknown[], source: unknown[]) => + target.length + source.length, +}); +// $ExpectType { foo: string; baz: { quuz: number; }; garply: number; } +deepmerge.all([a, i], { + arrayMerge: (target: unknown[], source: unknown[]) => + target.length + source.length, +}); + +// $ExpectType { foo: string; baz: string | { quuz: (string | number)[]; }; garply: number; } +deepmerge(a, i, { + customMerge: (key: string) => { + if (key === "bar") { + return (target: string, source: string) => target + source; + } + }, +}); +// $ExpectType { foo: string; baz: string | { quuz: (string | number)[]; }; garply: number; } +deepmerge.all([a, i], { + customMerge: (key: string) => { + if (key === "bar") { + return (target: string, source: string) => target + source; + } + }, +}); diff --git a/types/tsconfig.json b/types/tsconfig.json new file mode 100644 index 0000000..0bf6706 --- /dev/null +++ b/types/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "baseUrl": "..", + "paths": { "deepmerge": ["."] } + } +} From 89eea4335d5fcdec1d780c4643d7d9f14f164f6f Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Tue, 10 Nov 2020 14:47:14 +1300 Subject: [PATCH 5/8] fix: improve typings --- package-lock.json | 6 +- package.json | 2 +- types/index.d.ts | 179 ++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 161 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5ac4ded..e4ce241 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2013,9 +2013,9 @@ "dev": true }, "typescript": { - "version": "3.9.7", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", - "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", + "version": "4.1.1-rc", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.1-rc.tgz", + "integrity": "sha512-tgNcFrLIjlaMWEc7bKC0bxLNIt8BIAauY/HLUOQDyTP75HGskETtXOt46x4EKAHRKhWVLMc7yM02puTHa/yhCA==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index 78e4945..d019904 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "rollup-plugin-node-resolve": "^5.2.0", "tape": "^4.11.0", "ts-node": "7.0.1", - "typescript": "^3.9.3", + "typescript": "^4.1.1-rc", "uglify-js": "^3.6.1" }, "license": "MIT", diff --git a/types/index.d.ts b/types/index.d.ts index 7bf9cde..34aa7e2 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,32 +1,167 @@ +// Minimum TypeScript Version: 4.2 +// TODO: Can be reduce to version 4.1 upon it's release. + +type DeepMergeAll< + Ts extends readonly [any, ...any[]], + Options extends deepmerge.Options +> = Ts extends readonly [infer T1, ...any[]] + ? Ts extends readonly [any, infer T2, ...infer TRest] + ? TRest extends readonly never[] + ? DeepMerge + : DeepMerge, Options> + : T1 + : never; + +type DeepMerge = IsSame< + T1, + T2 +> extends true + ? T1 | T2 + : IsObjectOrArray extends true + ? IsObjectOrArray extends true + ? DeepMergeNonPrimitive + : MergeLeafs + : MergeLeafs; + +type DeepMergeNonPrimitive< + T1, + T2, + Options extends deepmerge.Options +> = ShouldMergeArrays extends true + ? DeepMergeArrays + : DeepMergeObjects; + +type DeepMergeObjects< + T1, + T2, + Options extends deepmerge.Options +> = ShouldMergeObjects extends true + ? DeepMergeObjectProps + : MergeLeafs; + +// @see https://github.com/microsoft/TypeScript/issues/41448 +type DeepMergeObjectProps< + T1, + T2, + Options extends deepmerge.Options +> = FlatternAlias< + { + -readonly [K in keyof T1]: Options["customMerge"] extends undefined + ? DeepMerge, ValueOfKey, Options> + : ReturnType> extends undefined + ? DeepMerge, ValueOfKey, Options> + : ReturnType< + NonNullable>> + >; + } & + { + -readonly [K in keyof T2]: Options["customMerge"] extends undefined + ? DeepMerge, ValueOfKey, Options> + : ReturnType> extends undefined + ? DeepMerge, ValueOfKey, Options> + : ReturnType< + NonNullable>> + >; + } +>; + +type DeepMergeArrays< + T1, + T2, + Options extends deepmerge.Options +> = T1 extends readonly [...infer E1] + ? T2 extends readonly [...infer E2] + ? Options["arrayMerge"] extends undefined + ? [...E1, ...E2] + : ReturnType> + : never + : never; + +type MergeLeafs = Is extends true + ? T1 + : Is extends true + ? T2 + : Is extends true + ? T1 + : T2; + +type FlatternAlias = T extends any + ? { + [K in keyof T]: T[K]; + } + : never; + type ValueOfKey = K extends keyof T ? T[K] : never; -// Is object AND NOT ('never' or 'array') -type IsObject = [T] extends [never] ? false : T extends unknown[] ? false : [T] extends [object] ? true : false; -type ShouldMergeProps = IsObject extends false ? false : IsObject extends false ? false : true; -type DeepMerge = ShouldMergeProps extends true - ? { - [K in keyof T1 | keyof T2]: DeepMerge, ValueOfKey>; - } - : T1 | T2; + +type Is = [T1] extends [T2] ? true : false; + +type IsSame = Is extends true ? Is : false; + +type IsObjectOrArray = Is extends true ? false : Is; + +type IsObject = Is> extends true + ? false + : IsObjectOrArray; + +type ShouldMergeObjects = IsObject extends true + ? IsObject + : false; + +type ShouldMergeArrays = Is> extends true + ? Is> + : false; + +type ArrayMerge = ( + target: Array, + source: Array, + options: Required +) => any; + +type ObjectMerge = ( + key: string, + options: Required +) => + | ((target: any, source: any, options?: deepmerge.Options) => any) + | undefined; + +type IsMergeable = (value: any) => boolean; + +type DefaultOptions = { + arrayMerge: undefined; + clone: true; + customMerge: undefined; + isMergeableObject: undefined; +}; /** -* ## JS Object Deep Merge -* look more info in https://github.com/TehShrike/deepmerge -* @param x the first obj -* @param y the second obj -* @param options deepmerge option -*/ -declare function deepmerge(x: T1, y: T2, options?: deepmerge.Options): DeepMerge + * Deeply merge two objects. + * + * @param target the first obj + * @param source the second obj + * @param options deepmerge option + */ +declare function deepmerge< + T1 extends object, + T2 extends object, + Options extends deepmerge.Options = DefaultOptions +>(target: T1, source: T2, options?: Options): DeepMerge; declare namespace deepmerge { - export interface Options { - arrayMerge?(target: any[], source: any[], options?: Options): any[]; + export type Options = { + arrayMerge?: ArrayMerge; clone?: boolean; - customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined; - isMergeableObject?(value: object): boolean; - } + customMerge?: ObjectMerge; + isMergeableObject?: IsMergeable; + }; - export function all (objects: object[], options?: Options): object; - export function all (objects: Partial[], options?: Options): T; + export function all< + Ts extends readonly [object, ...object[]], + O extends Options = DefaultOptions + >(objects: [...Ts], options?: O): DeepMergeAll; + export function all( + objects: ReadonlyArray, + options?: Options + ): object; } export = deepmerge; From 24b9aa90e4912f29cb80c625720e1ed0cf80d8b3 Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Tue, 10 Nov 2020 18:10:23 +1300 Subject: [PATCH 6/8] fix: handle user functions in typings --- types/index.d.ts | 91 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 21 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 34aa7e2..27f2500 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -46,34 +46,63 @@ type DeepMergeObjectProps< Options extends deepmerge.Options > = FlatternAlias< { - -readonly [K in keyof T1]: Options["customMerge"] extends undefined - ? DeepMerge, ValueOfKey, Options> - : ReturnType> extends undefined - ? DeepMerge, ValueOfKey, Options> - : ReturnType< - NonNullable>> - >; + -readonly [K in keyof T1]: DeepMergeProps< + ValueOfKey, + ValueOfKey, + Options + >; } & { - -readonly [K in keyof T2]: Options["customMerge"] extends undefined - ? DeepMerge, ValueOfKey, Options> - : ReturnType> extends undefined - ? DeepMerge, ValueOfKey, Options> - : ReturnType< - NonNullable>> - >; + -readonly [K in keyof T2]: DeepMergeProps< + ValueOfKey, + ValueOfKey, + Options + >; } >; +type DeepMergeProps = GetOption< + Options, + "isMergeableObject" +> extends undefined + ? GetOption extends undefined + ? DeepMerge + : DeepMergePropsCustom + : MergeMaybeLeafs; + +type DeepMergePropsCustom< + T1, + T2, + Options extends deepmerge.Options +> = ReturnType>> extends undefined + ? DeepMerge + : undefined extends ReturnType>> + ? IsArray extends true + ? IsArray extends true + ? DeepMergeArrays + : MergeLeafs + : IsArray extends true + ? MergeLeafs + : + | DeepMerge + | ReturnType< + NonNullable< + ReturnType>> + > + > + : ReturnType< + NonNullable>>> + >; + type DeepMergeArrays< T1, T2, Options extends deepmerge.Options > = T1 extends readonly [...infer E1] ? T2 extends readonly [...infer E2] - ? Options["arrayMerge"] extends undefined + ? GetOption extends undefined ? [...E1, ...E2] - : ReturnType> + : ReturnType>> : never : never; @@ -85,11 +114,24 @@ type MergeLeafs = Is extends true ? T1 : T2; -type FlatternAlias = T extends any - ? { - [K in keyof T]: T[K]; - } - : never; +type MergeMaybeLeafs = Is< + T2, + never +> extends true + ? T1 + : Is extends true + ? T2 + : Is extends true + ? T1 + : Is extends true + ? T2 + : Is extends false + ? DeepMerge + : Is extends false + ? DeepMerge + : unknown; + +type FlatternAlias = {} & { [P in keyof T]: T[P] }; type ValueOfKey = K extends keyof T ? T[K] : never; @@ -103,6 +145,8 @@ type IsObject = Is> extends true ? false : IsObjectOrArray; +type IsArray = Is>; + type ShouldMergeObjects = IsObject extends true ? IsObject : false; @@ -133,6 +177,11 @@ type DefaultOptions = { isMergeableObject: undefined; }; +type GetOption< + O extends deepmerge.Options, + K extends keyof deepmerge.Options +> = undefined extends O[K] ? DefaultOptions[K] : O[K]; + /** * Deeply merge two objects. * From ac37a6b45290754f743898f4ceb33bb297657b1d Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Wed, 11 Nov 2020 10:26:56 +1300 Subject: [PATCH 7/8] docs: document each type alias --- types/index.d.ts | 108 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 101 insertions(+), 7 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 27f2500..5b42043 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,6 +1,9 @@ // Minimum TypeScript Version: 4.2 // TODO: Can be reduce to version 4.1 upon it's release. +/** + * Deep merge 1 or more types given in an array. + */ type DeepMergeAll< Ts extends readonly [any, ...any[]], Options extends deepmerge.Options @@ -12,6 +15,9 @@ type DeepMergeAll< : T1 : never; +/** + * Deep merge 2 types. + */ type DeepMerge = IsSame< T1, T2 @@ -23,6 +29,9 @@ type DeepMerge = IsSame< : MergeLeafs : MergeLeafs; +/** + * Deep merge 2 objects (they may be arrays). + */ type DeepMergeNonPrimitive< T1, T2, @@ -31,6 +40,9 @@ type DeepMergeNonPrimitive< ? DeepMergeArrays : DeepMergeObjects; +/** + * Deep merge 2 non-array types. + */ type DeepMergeObjects< T1, T2, @@ -39,12 +51,15 @@ type DeepMergeObjects< ? DeepMergeObjectProps : MergeLeafs; -// @see https://github.com/microsoft/TypeScript/issues/41448 +/** + * Deep merge 2 non-array objects. + */ type DeepMergeObjectProps< T1, T2, Options extends deepmerge.Options > = FlatternAlias< + // @see https://github.com/microsoft/TypeScript/issues/41448 { -readonly [K in keyof T1]: DeepMergeProps< ValueOfKey, @@ -61,6 +76,10 @@ type DeepMergeObjectProps< } >; +/** + * Deep merge 2 types that are known to be properties of an object being deeply + * merged. + */ type DeepMergeProps = GetOption< Options, "isMergeableObject" @@ -70,6 +89,10 @@ type DeepMergeProps = GetOption< : DeepMergePropsCustom : MergeMaybeLeafs; +/** + * 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 DeepMergePropsCustom< T1, T2, @@ -94,6 +117,9 @@ type DeepMergePropsCustom< NonNullable>>> >; +/** + * Deep merge 2 arrays. + */ type DeepMergeArrays< T1, T2, @@ -106,6 +132,9 @@ type DeepMergeArrays< : never : never; +/** + * Get the leaf type of 2 types that can't be merged. + */ type MergeLeafs = Is extends true ? T1 : Is extends true @@ -114,6 +143,9 @@ type MergeLeafs = Is extends true ? T1 : T2; +/** + * Get the leaf type of 2 types that might not be able to be merged. + */ type MergeMaybeLeafs = Is< T2, never @@ -131,36 +163,72 @@ type MergeMaybeLeafs = Is< ? DeepMerge : 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; +/** + * 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 = Is extends true ? false : Is; -type IsObject = Is> extends true +/** + * Returns whether or not the given type a non-array object. + */ +type IsObject = IsArray extends true ? false : IsObjectOrArray; +/** + * Returns whether or not the given type an array. + */ type IsArray = Is>; +/** + * Returns whether or not 2 types are both non-array objects that can be merged. + */ type ShouldMergeObjects = IsObject extends true ? IsObject : false; -type ShouldMergeArrays = Is> extends true - ? Is> +/** + * Returns whether or not 2 types are both arrays that can be merged. + */ +type ShouldMergeArrays = IsArray extends true + ? IsArray : false; +/** + * A function that merges any 2 arrays. + */ type ArrayMerge = ( target: Array, source: Array, options: Required ) => any; +/** + * A function that merges any 2 non-arrays objects. + */ type ObjectMerge = ( key: string, options: Required @@ -168,8 +236,14 @@ type ObjectMerge = ( | ((target: any, source: any, options?: deepmerge.Options) => any) | undefined; +/** + * A function that determins if any non-array object is mergable. + */ type IsMergeable = (value: any) => boolean; +/** + * The default config options. + */ type DefaultOptions = { arrayMerge: undefined; clone: true; @@ -177,6 +251,10 @@ type DefaultOptions = { isMergeableObject: undefined; }; +/** + * Get the type of a given config option, defaulting to the default type if it + * wasn't given. + */ type GetOption< O extends deepmerge.Options, K extends keyof deepmerge.Options @@ -185,9 +263,9 @@ type GetOption< /** * Deeply merge two objects. * - * @param target the first obj - * @param source the second obj - * @param options deepmerge option + * @param target The first object. + * @param source The second object. + * @param options Deep merge options. */ declare function deepmerge< T1 extends object, @@ -196,6 +274,9 @@ declare function deepmerge< >(target: T1, source: T2, options?: Options): DeepMerge; declare namespace deepmerge { + /** + * Deep merge config options. + */ export type Options = { arrayMerge?: ArrayMerge; clone?: boolean; @@ -203,10 +284,23 @@ declare namespace deepmerge { isMergeableObject?: IsMergeable; }; + /** + * Deeply merge two or more objects. + * + * @param objects An tuple of the objects to merge. + * @param options Deep merge options. + */ export function all< Ts extends readonly [object, ...object[]], O extends Options = DefaultOptions >(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 all( objects: ReadonlyArray, options?: Options From bab1c5fdee17bc168a4484aaa55c4f4fed521eab Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Wed, 11 Nov 2020 10:52:04 +1300 Subject: [PATCH 8/8] refactor: renaming of types and simplifying --- types/index.d.ts | 133 ++++++++++++++++++++++------------------------- 1 file changed, 63 insertions(+), 70 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 5b42043..b7fedcc 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -8,7 +8,7 @@ type DeepMergeAll< Ts extends readonly [any, ...any[]], Options extends deepmerge.Options > = Ts extends readonly [infer T1, ...any[]] - ? Ts extends readonly [any, infer T2, ...infer TRest] + ? Ts extends readonly [T1, infer T2, ...infer TRest] ? TRest extends readonly never[] ? DeepMerge : DeepMerge, Options> @@ -23,52 +23,40 @@ type DeepMerge = IsSame< T2 > extends true ? T1 | T2 - : IsObjectOrArray extends true - ? IsObjectOrArray extends true - ? DeepMergeNonPrimitive - : MergeLeafs - : MergeLeafs; + : And, IsObjectOrArray> extends true + ? DeepMergeNonPrimitive + : Leaf; /** * Deep merge 2 objects (they may be arrays). */ -type DeepMergeNonPrimitive< - T1, - T2, - Options extends deepmerge.Options -> = ShouldMergeArrays extends true +type DeepMergeNonPrimitive = And< + IsArray, + IsArray +> extends true ? DeepMergeArrays - : DeepMergeObjects; - -/** - * Deep merge 2 non-array types. - */ -type DeepMergeObjects< - T1, - T2, - Options extends deepmerge.Options -> = ShouldMergeObjects extends true - ? DeepMergeObjectProps - : MergeLeafs; + : And, IsObject> extends true + ? DeepMergeObjects + : Leaf; /** * Deep merge 2 non-array objects. */ -type DeepMergeObjectProps< +type DeepMergeObjects< T1, T2, Options extends deepmerge.Options > = FlatternAlias< // @see https://github.com/microsoft/TypeScript/issues/41448 { - -readonly [K in keyof T1]: DeepMergeProps< + -readonly [K in keyof T1]: DeepMergeObjectProps< ValueOfKey, ValueOfKey, Options >; } & { - -readonly [K in keyof T2]: DeepMergeProps< + -readonly [K in keyof T2]: DeepMergeObjectProps< ValueOfKey, ValueOfKey, Options @@ -80,32 +68,32 @@ type DeepMergeObjectProps< * Deep merge 2 types that are known to be properties of an object being deeply * merged. */ -type DeepMergeProps = GetOption< - Options, - "isMergeableObject" -> extends undefined +type DeepMergeObjectProps = Or< + IsUndefinedOrNever, + IsUndefinedOrNever +> extends true + ? Leaf + : GetOption extends undefined ? GetOption extends undefined ? DeepMerge - : DeepMergePropsCustom - : MergeMaybeLeafs; + : 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 DeepMergePropsCustom< +type DeepMergeObjectPropsCustom< T1, T2, Options extends deepmerge.Options > = ReturnType>> extends undefined ? DeepMerge : undefined extends ReturnType>> - ? IsArray extends true - ? IsArray extends true + ? Or, IsArray> extends true + ? And, IsArray> extends true ? DeepMergeArrays - : MergeLeafs - : IsArray extends true - ? MergeLeafs + : Leaf : | DeepMerge | ReturnType< @@ -133,34 +121,25 @@ type DeepMergeArrays< : never; /** - * Get the leaf type of 2 types that can't be merged. + * Get the leaf type from 2 types that can't be merged. */ -type MergeLeafs = Is extends true +type Leaf = IsNever extends true ? T1 - : Is extends true + : IsNever extends true ? T2 - : Is extends true + : IsUndefinedOrNever extends true ? T1 : T2; /** - * Get the leaf type of 2 types that might not be able to be merged. + * Get the leaf type from 2 types that might not be able to be merged. */ -type MergeMaybeLeafs = Is< - T2, - never +type MaybeLeaf = Or< + Or, IsUndefinedOrNever>, + Not, IsObjectOrArray>> > extends true - ? T1 - : Is extends true - ? T2 - : Is extends true - ? T1 - : Is extends true - ? T2 - : Is extends false - ? DeepMerge - : Is extends false - ? DeepMerge + ? Leaf + // TODO: Handle case where return type of "isMergeableObject" is a typeguard. If it is we can do better than just "unknown". : unknown; /** @@ -181,6 +160,16 @@ type ValueOfKey = K extends keyof T ? T[K] : 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. */ @@ -189,33 +178,37 @@ type IsSame = Is extends true ? Is : false; /** * Returns whether or not the given type an object (arrays are objects). */ -type IsObjectOrArray = Is extends true ? false : Is; +type IsObjectOrArray = And>, T extends object ? true : false>; /** * Returns whether or not the given type a non-array object. */ -type IsObject = IsArray extends true - ? false - : IsObjectOrArray; +type IsObject = And, Not>>; /** * Returns whether or not the given type an array. */ -type IsArray = Is>; +type IsArray = And< + Not>, + T extends ReadonlyArray ? true : false +>; + +/** + * And operator for types. + */ +type And = T1 extends false + ? false + : T2; /** - * Returns whether or not 2 types are both non-array objects that can be merged. + * Or operator for types. */ -type ShouldMergeObjects = IsObject extends true - ? IsObject - : false; +type Or = T1 extends true ? true : T2; /** - * Returns whether or not 2 types are both arrays that can be merged. + * Not operator for types. */ -type ShouldMergeArrays = IsArray extends true - ? IsArray - : false; +type Not = T extends true ? false : true; /** * A function that merges any 2 arrays.