From 4d1149e855bf8a2d416ef2803f7e4de07bdd7589 Mon Sep 17 00:00:00 2001 From: Sachin Raja Date: Thu, 28 Apr 2022 19:16:14 -0700 Subject: [PATCH] fix: properly handle identifiers closes #12 --- dprint.json | 8 +- package.json | 26 +-- pnpm-lock.yaml | 501 +++++++++++++++++++++++++++++++++----------- src/index.ts | 13 +- src/utils.ts | 10 + test/enum.test.ts | 94 +++++++++ test/example.ts | 9 +- test/object.test.ts | 70 +++++++ 8 files changed, 584 insertions(+), 147 deletions(-) create mode 100644 test/enum.test.ts create mode 100644 test/object.test.ts diff --git a/dprint.json b/dprint.json index c40926a..4647fae 100644 --- a/dprint.json +++ b/dprint.json @@ -15,9 +15,9 @@ "includes": ["**/*.{ts,tsx,js,jsx,cjs,mjs,json,json5,md,yaml}"], "excludes": ["**/node_modules", "pnpm-lock.yaml", "dist"], "plugins": [ - "https://plugins.dprint.dev/typescript-0.60.0.wasm", - "https://plugins.dprint.dev/json-0.13.2.wasm", - "https://plugins.dprint.dev/markdown-0.11.3.wasm", - "https://plugins.dprint.dev/prettier-0.3.0.exe-plugin@c6c227493e655717b5f3d9c811ba576c82f2b060317bb233c6ec014958fbee19" + "https://plugins.dprint.dev/typescript-0.68.0.wasm", + "https://plugins.dprint.dev/json-0.15.1.wasm", + "https://plugins.dprint.dev/markdown-0.13.1.wasm", + "https://plugins.dprint.dev/prettier-0.7.0.json@4e846f43b32981258cef5095b3d732522947592e090ef52333801f9d6e8adb33" ] } diff --git a/package.json b/package.json index bd21c03..a59037f 100644 --- a/package.json +++ b/package.json @@ -47,22 +47,22 @@ "zod": "^3" }, "devDependencies": { - "@types/node": "17.0.21", - "@typescript-eslint/eslint-plugin": "5.12.1", - "@typescript-eslint/parser": "5.12.1", - "dprint": "0.23.0", - "esbuild-node-loader": "0.6.5", - "eslint": "8.10.0", - "eslint-config-prettier": "8.4.0", + "@types/node": "17.0.30", + "@typescript-eslint/eslint-plugin": "5.21.0", + "@typescript-eslint/parser": "5.21.0", + "dprint": "0.27.0", + "esbuild-node-loader": "0.8.0", + "eslint": "8.14.0", + "eslint-config-prettier": "8.5.0", "husky": "7.0.4", - "lint-staged": "12.3.4", + "lint-staged": "12.4.1", "npm-run-all": "4.1.5", "rimraf": "3.0.2", - "tsup": "5.11.13", - "typescript": "4.5.5", - "vite": "2.8.4", - "vitest": "0.5.8", - "zod": "3.12.0" + "tsup": "5.12.6", + "typescript": "4.6.4", + "vite": "2.9.6", + "vitest": "0.10.0", + "zod": "3.14.4" }, "sideEffects": false, "lint-staged": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7de0f4c..40eb2f9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,52 +1,52 @@ lockfileVersion: 5.3 specifiers: - '@types/node': 17.0.21 - '@typescript-eslint/eslint-plugin': 5.12.1 - '@typescript-eslint/parser': 5.12.1 - dprint: 0.23.0 - esbuild-node-loader: 0.6.5 - eslint: 8.10.0 - eslint-config-prettier: 8.4.0 + '@types/node': 17.0.30 + '@typescript-eslint/eslint-plugin': 5.21.0 + '@typescript-eslint/parser': 5.21.0 + dprint: 0.27.0 + esbuild-node-loader: 0.8.0 + eslint: 8.14.0 + eslint-config-prettier: 8.5.0 husky: 7.0.4 - lint-staged: 12.3.4 + lint-staged: 12.4.1 npm-run-all: 4.1.5 rimraf: 3.0.2 - tsup: 5.11.13 - typescript: 4.5.5 - vite: 2.8.4 - vitest: 0.5.8 - zod: 3.12.0 + tsup: 5.12.6 + typescript: 4.6.4 + vite: 2.9.6 + vitest: 0.10.0 + zod: 3.14.4 devDependencies: - '@types/node': 17.0.21 - '@typescript-eslint/eslint-plugin': 5.12.1_27a0c788acac7d65514027b167e3b3f6 - '@typescript-eslint/parser': 5.12.1_eslint@8.10.0+typescript@4.5.5 - dprint: 0.23.0 - esbuild-node-loader: 0.6.5 - eslint: 8.10.0 - eslint-config-prettier: 8.4.0_eslint@8.10.0 + '@types/node': 17.0.30 + '@typescript-eslint/eslint-plugin': 5.21.0_ade6595cb7be1524e723c025c098ae5d + '@typescript-eslint/parser': 5.21.0_eslint@8.14.0+typescript@4.6.4 + dprint: 0.27.0 + esbuild-node-loader: 0.8.0 + eslint: 8.14.0 + eslint-config-prettier: 8.5.0_eslint@8.14.0 husky: 7.0.4 - lint-staged: 12.3.4 + lint-staged: 12.4.1 npm-run-all: 4.1.5 rimraf: 3.0.2 - tsup: 5.11.13_typescript@4.5.5 - typescript: 4.5.5 - vite: 2.8.4 - vitest: 0.5.8 - zod: 3.12.0 + tsup: 5.12.6_typescript@4.6.4 + typescript: 4.6.4 + vite: 2.9.6 + vitest: 0.10.0 + zod: 3.14.4 packages: - /@eslint/eslintrc/1.2.0: - resolution: {integrity: sha512-igm9SjJHNEJRiUnecP/1R5T3wKLEJ7pL6e2P+GUSfCd0dGjPYYZve08uzw8L2J8foVHFz+NGu12JxRcU2gGo6w==} + /@eslint/eslintrc/1.2.2: + resolution: {integrity: sha512-lTVWHs7O2hjBFZunXTZYnYqtB9GakA1lnxIf+gKq2nY5gxkkNi/lQvveW6t8gFdOHTg6nG50Xs95PrLqVpcaLg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 debug: 4.3.3 espree: 9.3.1 globals: 13.12.1 - ignore: 4.0.6 + ignore: 5.2.0 import-fresh: 3.3.0 js-yaml: 4.1.0 minimatch: 3.1.2 @@ -94,23 +94,23 @@ packages: /@types/chai-subset/1.3.3: resolution: {integrity: sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==} dependencies: - '@types/chai': 4.3.0 + '@types/chai': 4.3.1 dev: true - /@types/chai/4.3.0: - resolution: {integrity: sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==} + /@types/chai/4.3.1: + resolution: {integrity: sha512-/zPMqDkzSZ8t3VtxOa4KPq7uzzW978M9Tvh+j7GHKuo6k6GTLxPJ4J5gE5cjfJ26pnXst0N5Hax8Sr0T2Mi9zQ==} dev: true /@types/json-schema/7.0.9: resolution: {integrity: sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==} dev: true - /@types/node/17.0.21: - resolution: {integrity: sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==} + /@types/node/17.0.30: + resolution: {integrity: sha512-oNBIZjIqyHYP8VCNAV9uEytXVeXG2oR0w9lgAXro20eugRQfY002qr3CUl6BAe+Yf/z3CRjPdz27Pu6WWtuSRw==} dev: true - /@typescript-eslint/eslint-plugin/5.12.1_27a0c788acac7d65514027b167e3b3f6: - resolution: {integrity: sha512-M499lqa8rnNK7mUv74lSFFttuUsubIRdAbHcVaP93oFcKkEmHmLqy2n7jM9C8DVmFMYK61ExrZU6dLYhQZmUpw==} + /@typescript-eslint/eslint-plugin/5.21.0_ade6595cb7be1524e723c025c098ae5d: + resolution: {integrity: sha512-fTU85q8v5ZLpoZEyn/u1S2qrFOhi33Edo2CZ0+q1gDaWWm0JuPh3bgOyU8lM0edIEYgKLDkPFiZX2MOupgjlyg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -120,24 +120,24 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.12.1_eslint@8.10.0+typescript@4.5.5 - '@typescript-eslint/scope-manager': 5.12.1 - '@typescript-eslint/type-utils': 5.12.1_eslint@8.10.0+typescript@4.5.5 - '@typescript-eslint/utils': 5.12.1_eslint@8.10.0+typescript@4.5.5 + '@typescript-eslint/parser': 5.21.0_eslint@8.14.0+typescript@4.6.4 + '@typescript-eslint/scope-manager': 5.21.0 + '@typescript-eslint/type-utils': 5.21.0_eslint@8.14.0+typescript@4.6.4 + '@typescript-eslint/utils': 5.21.0_eslint@8.14.0+typescript@4.6.4 debug: 4.3.3 - eslint: 8.10.0 + eslint: 8.14.0 functional-red-black-tree: 1.0.1 ignore: 5.2.0 regexpp: 3.2.0 semver: 7.3.5 - tsutils: 3.21.0_typescript@4.5.5 - typescript: 4.5.5 + tsutils: 3.21.0_typescript@4.6.4 + typescript: 4.6.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.12.1_eslint@8.10.0+typescript@4.5.5: - resolution: {integrity: sha512-6LuVUbe7oSdHxUWoX/m40Ni8gsZMKCi31rlawBHt7VtW15iHzjbpj2WLiToG2758KjtCCiLRKZqfrOdl3cNKuw==} + /@typescript-eslint/parser/5.21.0_eslint@8.14.0+typescript@4.6.4: + resolution: {integrity: sha512-8RUwTO77hstXUr3pZoWZbRQUxXcSXafZ8/5gpnQCfXvgmP9gpNlRGlWzvfbEQ14TLjmtU8eGnONkff8U2ui2Eg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -146,26 +146,26 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.12.1 - '@typescript-eslint/types': 5.12.1 - '@typescript-eslint/typescript-estree': 5.12.1_typescript@4.5.5 + '@typescript-eslint/scope-manager': 5.21.0 + '@typescript-eslint/types': 5.21.0 + '@typescript-eslint/typescript-estree': 5.21.0_typescript@4.6.4 debug: 4.3.3 - eslint: 8.10.0 - typescript: 4.5.5 + eslint: 8.14.0 + typescript: 4.6.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager/5.12.1: - resolution: {integrity: sha512-J0Wrh5xS6XNkd4TkOosxdpObzlYfXjAFIm9QxYLCPOcHVv1FyyFCPom66uIh8uBr0sZCrtS+n19tzufhwab8ZQ==} + /@typescript-eslint/scope-manager/5.21.0: + resolution: {integrity: sha512-XTX0g0IhvzcH/e3393SvjRCfYQxgxtYzL3UREteUneo72EFlt7UNoiYnikUtmGVobTbhUDByhJ4xRBNe+34kOQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.12.1 - '@typescript-eslint/visitor-keys': 5.12.1 + '@typescript-eslint/types': 5.21.0 + '@typescript-eslint/visitor-keys': 5.21.0 dev: true - /@typescript-eslint/type-utils/5.12.1_eslint@8.10.0+typescript@4.5.5: - resolution: {integrity: sha512-Gh8feEhsNLeCz6aYqynh61Vsdy+tiNNkQtc+bN3IvQvRqHkXGUhYkUi+ePKzP0Mb42se7FDb+y2SypTbpbR/Sg==} + /@typescript-eslint/type-utils/5.21.0_eslint@8.14.0+typescript@4.6.4: + resolution: {integrity: sha512-MxmLZj0tkGlkcZCSE17ORaHl8Th3JQwBzyXL/uvC6sNmu128LsgjTX0NIzy+wdH2J7Pd02GN8FaoudJntFvSOw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -174,22 +174,22 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.12.1_eslint@8.10.0+typescript@4.5.5 + '@typescript-eslint/utils': 5.21.0_eslint@8.14.0+typescript@4.6.4 debug: 4.3.3 - eslint: 8.10.0 - tsutils: 3.21.0_typescript@4.5.5 - typescript: 4.5.5 + eslint: 8.14.0 + tsutils: 3.21.0_typescript@4.6.4 + typescript: 4.6.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types/5.12.1: - resolution: {integrity: sha512-hfcbq4qVOHV1YRdhkDldhV9NpmmAu2vp6wuFODL71Y0Ixak+FLeEU4rnPxgmZMnGreGEghlEucs9UZn5KOfHJA==} + /@typescript-eslint/types/5.21.0: + resolution: {integrity: sha512-XnOOo5Wc2cBlq8Lh5WNvAgHzpjnEzxn4CJBwGkcau7b/tZ556qrWXQz4DJyChYg8JZAD06kczrdgFPpEQZfDsA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.12.1_typescript@4.5.5: - resolution: {integrity: sha512-ahOdkIY9Mgbza7L9sIi205Pe1inCkZWAHE1TV1bpxlU4RZNPtXaDZfiiFWcL9jdxvW1hDYZJXrFm+vlMkXRbBw==} + /@typescript-eslint/typescript-estree/5.21.0_typescript@4.6.4: + resolution: {integrity: sha512-Y8Y2T2FNvm08qlcoSMoNchh9y2Uj3QmjtwNMdRQkcFG7Muz//wfJBGBxh8R7HAGQFpgYpdHqUpEoPQk+q9Kjfg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -197,41 +197,41 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.12.1 - '@typescript-eslint/visitor-keys': 5.12.1 + '@typescript-eslint/types': 5.21.0 + '@typescript-eslint/visitor-keys': 5.21.0 debug: 4.3.3 globby: 11.1.0 is-glob: 4.0.3 semver: 7.3.5 - tsutils: 3.21.0_typescript@4.5.5 - typescript: 4.5.5 + tsutils: 3.21.0_typescript@4.6.4 + typescript: 4.6.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/5.12.1_eslint@8.10.0+typescript@4.5.5: - resolution: {integrity: sha512-Qq9FIuU0EVEsi8fS6pG+uurbhNTtoYr4fq8tKjBupsK5Bgbk2I32UGm0Sh+WOyjOPgo/5URbxxSNV6HYsxV4MQ==} + /@typescript-eslint/utils/5.21.0_eslint@8.14.0+typescript@4.6.4: + resolution: {integrity: sha512-q/emogbND9wry7zxy7VYri+7ydawo2HDZhRZ5k6yggIvXa7PvBbAAZ4PFH/oZLem72ezC4Pr63rJvDK/sTlL8Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: '@types/json-schema': 7.0.9 - '@typescript-eslint/scope-manager': 5.12.1 - '@typescript-eslint/types': 5.12.1 - '@typescript-eslint/typescript-estree': 5.12.1_typescript@4.5.5 - eslint: 8.10.0 + '@typescript-eslint/scope-manager': 5.21.0 + '@typescript-eslint/types': 5.21.0 + '@typescript-eslint/typescript-estree': 5.21.0_typescript@4.6.4 + eslint: 8.14.0 eslint-scope: 5.1.1 - eslint-utils: 3.0.0_eslint@8.10.0 + eslint-utils: 3.0.0_eslint@8.14.0 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/visitor-keys/5.12.1: - resolution: {integrity: sha512-l1KSLfupuwrXx6wc0AuOmC7Ko5g14ZOQ86wJJqRbdLbXLK02pK/DPiDDqCc7BqqiiA04/eAA6ayL0bgOrAkH7A==} + /@typescript-eslint/visitor-keys/5.21.0: + resolution: {integrity: sha512-SX8jNN+iHqAF0riZQMkm7e8+POXa/fXw5cxL+gjpyP+FI+JVNhii53EmQgDAfDcBpFekYSlO0fGytMQwRiMQCA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.12.1 + '@typescript-eslint/types': 5.21.0 eslint-visitor-keys: 3.3.0 dev: true @@ -355,13 +355,13 @@ packages: fill-range: 7.0.1 dev: true - /bundle-require/3.0.4_esbuild@0.14.23: + /bundle-require/3.0.4_esbuild@0.14.38: resolution: {integrity: sha512-VXG6epB1yrLAvWVQpl92qF347/UXmncQj7J3U8kZEbdVZ1ZkQyr4hYeL/9RvcE8vVVdp53dY78Fd/3pqfRqI1A==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} peerDependencies: esbuild: '>=0.13' dependencies: - esbuild: 0.14.23 + esbuild: 0.14.38 load-tsconfig: 0.2.3 dev: true @@ -518,6 +518,11 @@ packages: which: 2.0.2 dev: true + /data-uri-to-buffer/4.0.0: + resolution: {integrity: sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==} + engines: {node: '>= 12'} + dev: true + /debug/4.3.3: resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} engines: {node: '>=6.0'} @@ -575,8 +580,8 @@ packages: esutils: 2.0.3 dev: true - /dprint/0.23.0: - resolution: {integrity: sha512-SiUNfgluJpW5X/mhVxqFrjD7eIKRUvRVGZ2swc0clMMRxevWUlTAtkQLOJpGj9NflPPMQHAaE0WBKaOiRPfoCQ==} + /dprint/0.27.0: + resolution: {integrity: sha512-LowvtoZ9akBFcKtQ+CmnKj8VosBpf5zTAIDYK5p885xt6YGx62Bjmwzt4dQee2Fij5kREROSW5a3eK87nvGaEA==} hasBin: true requiresBuild: true dev: true @@ -634,6 +639,15 @@ packages: is-symbol: 1.0.4 dev: true + /esbuild-android-64/0.14.38: + resolution: {integrity: sha512-aRFxR3scRKkbmNuGAK+Gee3+yFxkTJO/cx83Dkyzo4CnQl/2zVSurtG6+G86EQIZ+w+VYngVyK7P3HyTBKu3nw==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + /esbuild-android-arm64/0.14.23: resolution: {integrity: sha512-k9sXem++mINrZty1v4FVt6nC5BQCFG4K2geCIUUqHNlTdFnuvcqsY7prcKZLFhqVC1rbcJAr9VSUGFL/vD4vsw==} engines: {node: '>=12'} @@ -643,6 +657,15 @@ packages: dev: true optional: true + /esbuild-android-arm64/0.14.38: + resolution: {integrity: sha512-L2NgQRWuHFI89IIZIlpAcINy9FvBk6xFVZ7xGdOwIm8VyhX1vNCEqUJO3DPSSy945Gzdg98cxtNt8Grv1CsyhA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /esbuild-darwin-64/0.14.23: resolution: {integrity: sha512-lB0XRbtOYYL1tLcYw8BoBaYsFYiR48RPrA0KfA/7RFTr4MV7Bwy/J4+7nLsVnv9FGuQummM3uJ93J3ptaTqFug==} engines: {node: '>=12'} @@ -652,6 +675,15 @@ packages: dev: true optional: true + /esbuild-darwin-64/0.14.38: + resolution: {integrity: sha512-5JJvgXkX87Pd1Og0u/NJuO7TSqAikAcQQ74gyJ87bqWRVeouky84ICoV4sN6VV53aTW+NE87qLdGY4QA2S7KNA==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /esbuild-darwin-arm64/0.14.23: resolution: {integrity: sha512-yat73Z/uJ5tRcfRiI4CCTv0FSnwErm3BJQeZAh+1tIP0TUNh6o+mXg338Zl5EKChD+YGp6PN+Dbhs7qa34RxSw==} engines: {node: '>=12'} @@ -661,6 +693,15 @@ packages: dev: true optional: true + /esbuild-darwin-arm64/0.14.38: + resolution: {integrity: sha512-eqF+OejMI3mC5Dlo9Kdq/Ilbki9sQBw3QlHW3wjLmsLh+quNfHmGMp3Ly1eWm981iGBMdbtSS9+LRvR2T8B3eQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /esbuild-freebsd-64/0.14.23: resolution: {integrity: sha512-/1xiTjoLuQ+LlbfjJdKkX45qK/M7ARrbLmyf7x3JhyQGMjcxRYVR6Dw81uH3qlMHwT4cfLW4aEVBhP1aNV7VsA==} engines: {node: '>=12'} @@ -670,6 +711,15 @@ packages: dev: true optional: true + /esbuild-freebsd-64/0.14.38: + resolution: {integrity: sha512-epnPbhZUt93xV5cgeY36ZxPXDsQeO55DppzsIgWM8vgiG/Rz+qYDLmh5ts3e+Ln1wA9dQ+nZmVHw+RjaW3I5Ig==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /esbuild-freebsd-arm64/0.14.23: resolution: {integrity: sha512-uyPqBU/Zcp6yEAZS4LKj5jEE0q2s4HmlMBIPzbW6cTunZ8cyvjG6YWpIZXb1KK3KTJDe62ltCrk3VzmWHp+iLg==} engines: {node: '>=12'} @@ -679,6 +729,15 @@ packages: dev: true optional: true + /esbuild-freebsd-arm64/0.14.38: + resolution: {integrity: sha512-/9icXUYJWherhk+y5fjPI5yNUdFPtXHQlwP7/K/zg8t8lQdHVj20SqU9/udQmeUo5pDFHMYzcEFfJqgOVeKNNQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-32/0.14.23: resolution: {integrity: sha512-37R/WMkQyUfNhbH7aJrr1uCjDVdnPeTHGeDhZPUNhfoHV0lQuZNCKuNnDvlH/u/nwIYZNdVvz1Igv5rY/zfrzQ==} engines: {node: '>=12'} @@ -688,6 +747,15 @@ packages: dev: true optional: true + /esbuild-linux-32/0.14.38: + resolution: {integrity: sha512-QfgfeNHRFvr2XeHFzP8kOZVnal3QvST3A0cgq32ZrHjSMFTdgXhMhmWdKzRXP/PKcfv3e2OW9tT9PpcjNvaq6g==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-64/0.14.23: resolution: {integrity: sha512-H0gztDP60qqr8zoFhAO64waoN5yBXkmYCElFklpd6LPoobtNGNnDe99xOQm28+fuD75YJ7GKHzp/MLCLhw2+vQ==} engines: {node: '>=12'} @@ -697,6 +765,15 @@ packages: dev: true optional: true + /esbuild-linux-64/0.14.38: + resolution: {integrity: sha512-uuZHNmqcs+Bj1qiW9k/HZU3FtIHmYiuxZ/6Aa+/KHb/pFKr7R3aVqvxlAudYI9Fw3St0VCPfv7QBpUITSmBR1Q==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-arm/0.14.23: resolution: {integrity: sha512-x64CEUxi8+EzOAIpCUeuni0bZfzPw/65r8tC5cy5zOq9dY7ysOi5EVQHnzaxS+1NmV+/RVRpmrzGw1QgY2Xpmw==} engines: {node: '>=12'} @@ -706,6 +783,15 @@ packages: dev: true optional: true + /esbuild-linux-arm/0.14.38: + resolution: {integrity: sha512-FiFvQe8J3VKTDXG01JbvoVRXQ0x6UZwyrU4IaLBZeq39Bsbatd94Fuc3F1RGqPF5RbIWW7RvkVQjn79ejzysnA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-arm64/0.14.23: resolution: {integrity: sha512-c4MLOIByNHR55n3KoYf9hYDfBRghMjOiHLaoYLhkQkIabb452RWi+HsNgB41sUpSlOAqfpqKPFNg7VrxL3UX9g==} engines: {node: '>=12'} @@ -715,6 +801,15 @@ packages: dev: true optional: true + /esbuild-linux-arm64/0.14.38: + resolution: {integrity: sha512-HlMGZTEsBrXrivr64eZ/EO0NQM8H8DuSENRok9d+Jtvq8hOLzrxfsAT9U94K3KOGk2XgCmkaI2KD8hX7F97lvA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-mips64le/0.14.23: resolution: {integrity: sha512-kHKyKRIAedYhKug2EJpyJxOUj3VYuamOVA1pY7EimoFPzaF3NeY7e4cFBAISC/Av0/tiV0xlFCt9q0HJ68IBIw==} engines: {node: '>=12'} @@ -724,6 +819,15 @@ packages: dev: true optional: true + /esbuild-linux-mips64le/0.14.38: + resolution: {integrity: sha512-qd1dLf2v7QBiI5wwfil9j0HG/5YMFBAmMVmdeokbNAMbcg49p25t6IlJFXAeLzogv1AvgaXRXvgFNhScYEUXGQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-ppc64le/0.14.23: resolution: {integrity: sha512-7ilAiJEPuJJnJp/LiDO0oJm5ygbBPzhchJJh9HsHZzeqO+3PUzItXi+8PuicY08r0AaaOe25LA7sGJ0MzbfBag==} engines: {node: '>=12'} @@ -733,6 +837,15 @@ packages: dev: true optional: true + /esbuild-linux-ppc64le/0.14.38: + resolution: {integrity: sha512-mnbEm7o69gTl60jSuK+nn+pRsRHGtDPfzhrqEUXyCl7CTOCLtWN2bhK8bgsdp6J/2NyS/wHBjs1x8aBWwP2X9Q==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-riscv64/0.14.23: resolution: {integrity: sha512-fbL3ggK2wY0D8I5raPIMPhpCvODFE+Bhb5QGtNP3r5aUsRR6TQV+ZBXIaw84iyvKC8vlXiA4fWLGhghAd/h/Zg==} engines: {node: '>=12'} @@ -742,6 +855,15 @@ packages: dev: true optional: true + /esbuild-linux-riscv64/0.14.38: + resolution: {integrity: sha512-+p6YKYbuV72uikChRk14FSyNJZ4WfYkffj6Af0/Tw63/6TJX6TnIKE+6D3xtEc7DeDth1fjUOEqm+ApKFXbbVQ==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-linux-s390x/0.14.23: resolution: {integrity: sha512-GHMDCyfy7+FaNSO8RJ8KCFsnax8fLUsOrj9q5Gi2JmZMY0Zhp75keb5abTFCq2/Oy6KVcT0Dcbyo/bFb4rIFJA==} engines: {node: '>=12'} @@ -751,6 +873,15 @@ packages: dev: true optional: true + /esbuild-linux-s390x/0.14.38: + resolution: {integrity: sha512-0zUsiDkGJiMHxBQ7JDU8jbaanUY975CdOW1YDrurjrM0vWHfjv9tLQsW9GSyEb/heSK1L5gaweRjzfUVBFoybQ==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + /esbuild-netbsd-64/0.14.23: resolution: {integrity: sha512-ovk2EX+3rrO1M2lowJfgMb/JPN1VwVYrx0QPUyudxkxLYrWeBxDKQvc6ffO+kB4QlDyTfdtAURrVzu3JeNdA2g==} engines: {node: '>=12'} @@ -760,10 +891,21 @@ packages: dev: true optional: true - /esbuild-node-loader/0.6.5: - resolution: {integrity: sha512-uPP+dllWm38cFvDysdocutN3lfe5pTIbddAHp1ENyLzpHYqE2r+3Wo+pfg9X3p8DFWwzIisft5YkeBIthIcixw==} + /esbuild-netbsd-64/0.14.38: + resolution: {integrity: sha512-cljBAApVwkpnJZfnRVThpRBGzCi+a+V9Ofb1fVkKhtrPLDYlHLrSYGtmnoTVWDQdU516qYI8+wOgcGZ4XIZh0Q==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /esbuild-node-loader/0.8.0: + resolution: {integrity: sha512-BJaecVcClXVa5lO7TbHp+CgWtUmYrtZHyPYDx1JVTO3OOXdQM569vbJOeQGPucbYThuWTiNUUNeLEc4+EZk8QQ==} dependencies: esbuild: 0.14.23 + node-fetch: 3.2.4 + semver: 7.3.5 dev: true /esbuild-openbsd-64/0.14.23: @@ -775,6 +917,15 @@ packages: dev: true optional: true + /esbuild-openbsd-64/0.14.38: + resolution: {integrity: sha512-CDswYr2PWPGEPpLDUO50mL3WO/07EMjnZDNKpmaxUPsrW+kVM3LoAqr/CE8UbzugpEiflYqJsGPLirThRB18IQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /esbuild-sunos-64/0.14.23: resolution: {integrity: sha512-hAzeBeET0+SbScknPzS2LBY6FVDpgE+CsHSpe6CEoR51PApdn2IB0SyJX7vGelXzlyrnorM4CAsRyb9Qev4h9g==} engines: {node: '>=12'} @@ -784,6 +935,15 @@ packages: dev: true optional: true + /esbuild-sunos-64/0.14.38: + resolution: {integrity: sha512-2mfIoYW58gKcC3bck0j7lD3RZkqYA7MmujFYmSn9l6TiIcAMpuEvqksO+ntBgbLep/eyjpgdplF7b+4T9VJGOA==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + /esbuild-windows-32/0.14.23: resolution: {integrity: sha512-Kttmi3JnohdaREbk6o9e25kieJR379TsEWF0l39PQVHXq3FR6sFKtVPgY8wk055o6IB+rllrzLnbqOw/UV60EA==} engines: {node: '>=12'} @@ -793,6 +953,15 @@ packages: dev: true optional: true + /esbuild-windows-32/0.14.38: + resolution: {integrity: sha512-L2BmEeFZATAvU+FJzJiRLFUP+d9RHN+QXpgaOrs2klshoAm1AE6Us4X6fS9k33Uy5SzScn2TpcgecbqJza1Hjw==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /esbuild-windows-64/0.14.23: resolution: {integrity: sha512-JtIT0t8ymkpl6YlmOl6zoSWL5cnCgyLaBdf/SiU/Eg3C13r0NbHZWNT/RDEMKK91Y6t79kTs3vyRcNZbfu5a8g==} engines: {node: '>=12'} @@ -802,6 +971,15 @@ packages: dev: true optional: true + /esbuild-windows-64/0.14.38: + resolution: {integrity: sha512-Khy4wVmebnzue8aeSXLC+6clo/hRYeNIm0DyikoEqX+3w3rcvrhzpoix0S+MF9vzh6JFskkIGD7Zx47ODJNyCw==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /esbuild-windows-arm64/0.14.23: resolution: {integrity: sha512-cTFaQqT2+ik9e4hePvYtRZQ3pqOvKDVNarzql0VFIzhc0tru/ZgdLoXd6epLiKT+SzoSce6V9YJ+nn6RCn6SHw==} engines: {node: '>=12'} @@ -811,6 +989,15 @@ packages: dev: true optional: true + /esbuild-windows-arm64/0.14.38: + resolution: {integrity: sha512-k3FGCNmHBkqdJXuJszdWciAH77PukEyDsdIryEHn9cKLQFxzhT39dSumeTuggaQcXY57UlmLGIkklWZo2qzHpw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /esbuild/0.14.23: resolution: {integrity: sha512-XjnIcZ9KB6lfonCa+jRguXyRYcldmkyZ99ieDksqW/C8bnyEX299yA4QH2XcgijCgaddEZePPTgvx/2imsq7Ig==} engines: {node: '>=12'} @@ -838,6 +1025,34 @@ packages: esbuild-windows-arm64: 0.14.23 dev: true + /esbuild/0.14.38: + resolution: {integrity: sha512-12fzJ0fsm7gVZX1YQ1InkOE5f9Tl7cgf6JPYXRJtPIoE0zkWAbHdPHVPPaLi9tYAcEBqheGzqLn/3RdTOyBfcA==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + esbuild-android-64: 0.14.38 + esbuild-android-arm64: 0.14.38 + esbuild-darwin-64: 0.14.38 + esbuild-darwin-arm64: 0.14.38 + esbuild-freebsd-64: 0.14.38 + esbuild-freebsd-arm64: 0.14.38 + esbuild-linux-32: 0.14.38 + esbuild-linux-64: 0.14.38 + esbuild-linux-arm: 0.14.38 + esbuild-linux-arm64: 0.14.38 + esbuild-linux-mips64le: 0.14.38 + esbuild-linux-ppc64le: 0.14.38 + esbuild-linux-riscv64: 0.14.38 + esbuild-linux-s390x: 0.14.38 + esbuild-netbsd-64: 0.14.38 + esbuild-openbsd-64: 0.14.38 + esbuild-sunos-64: 0.14.38 + esbuild-windows-32: 0.14.38 + esbuild-windows-64: 0.14.38 + esbuild-windows-arm64: 0.14.38 + dev: true + /escape-string-regexp/1.0.5: resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=} engines: {node: '>=0.8.0'} @@ -848,13 +1063,13 @@ packages: engines: {node: '>=10'} dev: true - /eslint-config-prettier/8.4.0_eslint@8.10.0: - resolution: {integrity: sha512-CFotdUcMY18nGRo5KGsnNxpznzhkopOcOo0InID+sgQssPrzjvsyKZPvOgymTFeHrFuC3Tzdf2YndhXtULK9Iw==} + /eslint-config-prettier/8.5.0_eslint@8.14.0: + resolution: {integrity: sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.10.0 + eslint: 8.14.0 dev: true /eslint-scope/5.1.1: @@ -873,13 +1088,13 @@ packages: estraverse: 5.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.10.0: + /eslint-utils/3.0.0_eslint@8.14.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.10.0 + eslint: 8.14.0 eslint-visitor-keys: 2.1.0 dev: true @@ -893,12 +1108,12 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.10.0: - resolution: {integrity: sha512-tcI1D9lfVec+R4LE1mNDnzoJ/f71Kl/9Cv4nG47jOueCMBrCCKYXr4AUVS7go6mWYGFD4+EoN6+eXSrEbRzXVw==} + /eslint/8.14.0: + resolution: {integrity: sha512-3/CE4aJX7LNEiE3i6FeodHmI/38GZtWCsAtsymScmzYapx8q1nVVb+eLcLSzATmCPXw5pT4TqVs1E0OmxAd9tw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint/eslintrc': 1.2.0 + '@eslint/eslintrc': 1.2.2 '@humanwhocodes/config-array': 0.9.5 ajv: 6.12.6 chalk: 4.1.2 @@ -907,7 +1122,7 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.10.0 + eslint-utils: 3.0.0_eslint@8.14.0 eslint-visitor-keys: 3.3.0 espree: 9.3.1 esquery: 1.4.0 @@ -1019,6 +1234,14 @@ packages: reusify: 1.0.4 dev: true + /fetch-blob/3.1.5: + resolution: {integrity: sha512-N64ZpKqoLejlrwkIAnb9iLSA3Vx/kjgzpcDhygcqJ2KKjky8nCgUQ+dzXtbrLaWZGZNmNfQTsiQ0weZ1svglHg==} + engines: {node: ^12.20 || >= 14.13} + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 3.2.1 + dev: true + /file-entry-cache/6.0.1: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} @@ -1045,6 +1268,13 @@ packages: resolution: {integrity: sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==} dev: true + /formdata-polyfill/4.0.10: + resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} + engines: {node: '>=12.20.0'} + dependencies: + fetch-blob: 3.1.5 + dev: true + /fs.realpath/1.0.0: resolution: {integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=} dev: true @@ -1197,11 +1427,6 @@ packages: hasBin: true dev: true - /ignore/4.0.6: - resolution: {integrity: sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==} - engines: {node: '>= 4'} - dev: true - /ignore/5.2.0: resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==} engines: {node: '>= 4'} @@ -1409,8 +1634,8 @@ packages: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} dev: true - /lint-staged/12.3.4: - resolution: {integrity: sha512-yv/iK4WwZ7/v0GtVkNb3R82pdL9M+ScpIbJLJNyCXkJ1FGaXvRCOg/SeL59SZtPpqZhE7BD6kPKFLIDUhDx2/w==} + /lint-staged/12.4.1: + resolution: {integrity: sha512-PTXgzpflrQ+pODQTG116QNB+Q6uUTDg5B5HqGvNhoQSGt8Qy+MA/6zSnR8n38+sxP5TapzeQGTvoKni0KRS8Vg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hasBin: true dependencies: @@ -1424,6 +1649,7 @@ packages: micromatch: 4.0.4 normalize-path: 3.0.0 object-inspect: 1.12.0 + pidtree: 0.5.0 string-argv: 0.3.1 supports-color: 9.2.1 yaml: 1.10.2 @@ -1556,6 +1782,20 @@ packages: resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==} dev: true + /node-domexception/1.0.0: + resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} + engines: {node: '>=10.5.0'} + dev: true + + /node-fetch/3.2.4: + resolution: {integrity: sha512-WvYJRN7mMyOLurFR2YpysQGuwYrJN+qrrpHjJDuKMcSPdfFccRUla/kng2mz6HWSBxJcqPbvatS6Gb4RhOzCJw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + data-uri-to-buffer: 4.0.0 + fetch-blob: 3.1.5 + formdata-polyfill: 4.0.10 + dev: true + /normalize-package-data/2.5.0: resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} dependencies: @@ -1714,6 +1954,12 @@ packages: hasBin: true dev: true + /pidtree/0.5.0: + resolution: {integrity: sha512-9nxspIM7OpZuhBxPg73Zvyq7j1QMPMPsGKTqRc2XOaFQauDvoNz9fM1Wdkjmeo7l9GXOZiRs97sPkuayl39wjA==} + engines: {node: '>=0.10'} + hasBin: true + dev: true + /pify/3.0.0: resolution: {integrity: sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=} engines: {node: '>=4'} @@ -1737,8 +1983,8 @@ packages: yaml: 1.10.2 dev: true - /postcss/8.4.7: - resolution: {integrity: sha512-L9Ye3r6hkkCeOETQX6iOaWZgjp3LL6Lpqm6EtgbKrgqGGteRMNb9vzBfRL96YOSu8o7x3MfIH9Mo5cPJFGrW6A==} + /postcss/8.4.12: + resolution: {integrity: sha512-lg6eITwYe9v6Hr5CncVbK70SoioNQIq81nsaG86ev5hAidQvmOeETBqs7jm43K2F5/Ley3ytDtriImV6TpNiSg==} engines: {node: ^10 || ^12 || >=14} dependencies: nanoid: 3.3.1 @@ -2098,8 +2344,8 @@ packages: engines: {node: '>=14.0.0'} dev: true - /tinyspy/0.3.0: - resolution: {integrity: sha512-c5uFHqtUp74R2DJE3/Efg0mH5xicmgziaQXMm/LvuuZn3RdpADH32aEGDRyCzObXT1DNfwDMqRQ/Drh1MlO12g==} + /tinyspy/0.3.2: + resolution: {integrity: sha512-2+40EP4D3sFYy42UkgkFFB+kiX2Tg3URG/lVvAZFfLxgGpnWl5qQJuBw1gaLttq8UOS+2p3C0WrhJnQigLTT2Q==} engines: {node: '>=14.0.0'} dev: true @@ -2127,8 +2373,8 @@ packages: resolution: {integrity: sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==} dev: true - /tsup/5.11.13_typescript@4.5.5: - resolution: {integrity: sha512-NVMK01gVmojZn7+iZwxRK1CzW2BIabaVMyEjs7Nm9lm4DrSf7IAqs2F3fg0vT7rH72x1cIBsW9U/TlWrCvHVQQ==} + /tsup/5.12.6_typescript@4.6.4: + resolution: {integrity: sha512-tpePOgdMRKRgazF+ujq9k1Fo44PUFUJJjRLtxq87pQrYW/Ub/fu1GpFGLzdUF9qjJ4FX1ykhf2d9mWCNy+jAtg==} hasBin: true peerDependencies: typescript: ^4.1.0 @@ -2136,11 +2382,11 @@ packages: typescript: optional: true dependencies: - bundle-require: 3.0.4_esbuild@0.14.23 + bundle-require: 3.0.4_esbuild@0.14.38 cac: 6.7.12 chokidar: 3.5.3 debug: 4.3.3 - esbuild: 0.14.23 + esbuild: 0.14.38 execa: 5.1.1 globby: 11.1.0 joycon: 3.1.1 @@ -2150,20 +2396,20 @@ packages: source-map: 0.7.3 sucrase: 3.20.3 tree-kill: 1.2.2 - typescript: 4.5.5 + typescript: 4.6.4 transitivePeerDependencies: - supports-color - ts-node dev: true - /tsutils/3.21.0_typescript@4.5.5: + /tsutils/3.21.0_typescript@4.6.4: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 4.5.5 + typescript: 4.6.4 dev: true /type-check/0.4.0: @@ -2188,8 +2434,8 @@ packages: engines: {node: '>=10'} dev: true - /typescript/4.5.5: - resolution: {integrity: sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==} + /typescript/4.6.4: + resolution: {integrity: sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==} engines: {node: '>=4.2.0'} hasBin: true dev: true @@ -2220,8 +2466,8 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite/2.8.4: - resolution: {integrity: sha512-GwtOkkaT2LDI82uWZKcrpRQxP5tymLnC7hVHHqNkhFNknYr0hJUlDLfhVRgngJvAy3RwypkDCWtTKn1BjO96Dw==} + /vite/2.9.6: + resolution: {integrity: sha512-3IffdrByHW95Yjv0a13TQOQfJs7L5dVlSPuTt432XLbRMriWbThqJN2k/IS6kXn5WY4xBLhK9XoaWay1B8VzUw==} engines: {node: '>=12.2.0'} hasBin: true peerDependencies: @@ -2236,17 +2482,17 @@ packages: stylus: optional: true dependencies: - esbuild: 0.14.23 - postcss: 8.4.7 + esbuild: 0.14.38 + postcss: 8.4.12 resolve: 1.22.0 rollup: 2.68.0 optionalDependencies: fsevents: 2.3.2 dev: true - /vitest/0.5.8: - resolution: {integrity: sha512-LTtjwaNiFKeDm/G/XbvXzFSFRB91uMIjszwfRRr5gNpdhoo9IE2BIeAMAyKbpGaj0oAqTOltCQ6A0x/7b/1Ueg==} - engines: {node: '>=14.14.0'} + /vitest/0.10.0: + resolution: {integrity: sha512-8UXemUg9CA4QYppDTsDV76nH0e1p6C8lV9q+o9i0qMSK9AQ7vA2sjoxtkDP0M+pwNmc3ZGYetBXgSJx0M1D/gg==} + engines: {node: '>=v14.16.0'} hasBin: true peerDependencies: '@vitest/ui': '*' @@ -2263,19 +2509,24 @@ packages: jsdom: optional: true dependencies: - '@types/chai': 4.3.0 + '@types/chai': 4.3.1 '@types/chai-subset': 1.3.3 chai: 4.3.6 local-pkg: 0.4.1 tinypool: 0.1.2 - tinyspy: 0.3.0 - vite: 2.8.4 + tinyspy: 0.3.2 + vite: 2.9.6 transitivePeerDependencies: - less - sass - stylus dev: true + /web-streams-polyfill/3.2.1: + resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==} + engines: {node: '>= 8'} + dev: true + /which-boxed-primitive/1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} dependencies: @@ -2337,6 +2588,6 @@ packages: engines: {node: '>= 6'} dev: true - /zod/3.12.0: - resolution: {integrity: sha512-w+mmntgEL4hDDL5NLFdN6Fq2DSzxfmlSoJqiYE1/CApO8EkOCxvJvRYEVf8Vr/lRs3i6gqoiyFM6KRcWqqdBzQ==} + /zod/3.14.4: + resolution: {integrity: sha512-U9BFLb2GO34Sfo9IUYp0w3wJLlmcyGoMd75qU9yf+DrdGA4kEx6e+l9KOkAlyUO0PSQzZCa3TR4qVlcmwqSDuw==} dev: true diff --git a/src/index.ts b/src/index.ts index 816da0f..fd4b566 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,6 +13,7 @@ import { createTypeAlias, createTypeReferenceFromString, createUnknownKeywordNode, + getIdentifierOrStringLiteral, maybeIdentifierToTypeReference, printNode, } from './utils' @@ -93,7 +94,7 @@ const zodToTsNode = ( return f.createPropertySignature( undefined, - f.createIdentifier(key), + getIdentifierOrStringLiteral(key), isOptional ? f.createToken(ts.SyntaxKind.QuestionToken) : undefined, type, ) @@ -132,10 +133,14 @@ const zodToTsNode = ( if (!type) return createUnknownKeywordNode() if (options.resolveNativeEnums) { - const enumMembers = Object.entries(zod._def.values as Record).map(([key, value]) => { + const enumMembers = Object.entries(zod._def.values as Record).map(([key, value]) => { + const literal = typeof value === 'number' + ? f.createNumericLiteral(value) + : f.createStringLiteral(value) + return f.createEnumMember( - f.createIdentifier(key), - f.createStringLiteral(value), + getIdentifierOrStringLiteral(key), + literal, ) }) diff --git a/src/utils.ts b/src/utils.ts index 252e235..18251cc 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -35,3 +35,13 @@ export const withGetType = (schema: T, getType: schema.getType = getType return schema } + +const identifierRE = /^[A-Za-z_$][A-Za-z0-9_$]*$/ + +export const getIdentifierOrStringLiteral = (str: string) => { + if (identifierRE.test(str)) { + return f.createIdentifier(str) + } + + return f.createStringLiteral(str) +} diff --git a/test/enum.test.ts b/test/enum.test.ts new file mode 100644 index 0000000..74dd236 --- /dev/null +++ b/test/enum.test.ts @@ -0,0 +1,94 @@ +import { describe, expect, it } from 'vitest' +import { z } from 'zod' +import { withGetType, zodToTs } from '../src' +import { printNodeTest } from './utils' + +describe('Color enum', () => { + enum Color { + Red, + Green, + Blue, + } + + it('uses identifier provided using `withGetType`', () => { + const schema = withGetType( + z.nativeEnum(Color), + (ts) => ts.factory.createIdentifier('Color'), + ) + + const { node } = zodToTs(schema) + + expect(printNodeTest(node)).toMatchInlineSnapshot('"Color"') + }) + + it('handles numeric literals with resolveNativeEnums', () => { + const schema = withGetType( + z.nativeEnum(Color), + (ts) => ts.factory.createIdentifier('Color'), + ) + + const { store } = zodToTs(schema, undefined, { resolveNativeEnums: true }) + + expect(printNodeTest(store.nativeEnums[0])).toMatchInlineSnapshot(` + "enum Color { + \\"0\\" = \\"Red\\", + \\"1\\" = \\"Green\\", + \\"2\\" = \\"Blue\\", + Red = 0, + Green = 1, + Blue = 2 + }" + `) + }) +}) + +describe('Fruit enum', () => { + enum Fruit { + Apple = 'apple', + Banana = 'banana', + Cantaloupe = 'cantaloupe', + } + + it('handles string literals with resolveNativeEnums', () => { + const schema = withGetType( + z.nativeEnum(Fruit), + (ts) => ts.factory.createIdentifier('Fruit'), + ) + + const { store } = zodToTs(schema, undefined, { resolveNativeEnums: true }) + + expect(printNodeTest(store.nativeEnums[0])).toMatchInlineSnapshot(` + "enum Fruit { + Apple = \\"apple\\", + Banana = \\"banana\\", + Cantaloupe = \\"cantaloupe\\" + }" + `) + }) +}) + +it('handles string literal properties', () => { + enum StringLiteral { + 'Two Words', + '\'Quotes"', + '\\"Escaped\\"', + } + + const schema = withGetType( + z.nativeEnum(StringLiteral), + (ts) => ts.factory.createIdentifier('StringLiteral'), + ) + + const { store } = zodToTs(schema, undefined, { resolveNativeEnums: true }) + + expect(printNodeTest(store.nativeEnums[0])).toMatchInlineSnapshot(` + "enum StringLiteral { + \\"0\\" = \\"Two Words\\", + \\"1\\" = \\"'Quotes\\\\\\"\\", + \\"2\\" = \\"\\\\\\\\\\\\\\"Escaped\\\\\\\\\\\\\\"\\", + \\"Two Words\\" = 0, + \\"'Quotes\\\\\\"\\" = 1, + \\"\\\\\\\\\\\\\\"Escaped\\\\\\\\\\\\\\"\\" = 2 + }" + `) +}) diff --git a/test/example.ts b/test/example.ts index 20d9f9d..689233e 100644 --- a/test/example.ts +++ b/test/example.ts @@ -5,6 +5,7 @@ enum Fruits { Apple = 'apple', Banana = 'banana', Cantaloupe = 'cantaloupe', + A = 5, } const example2 = z.object({ @@ -92,12 +93,18 @@ export const example = z.object({ aa: nativeEnum, bb: dateType, cc: z.lazy(() => z.string()), + dd: z.nativeEnum(Fruits), }) type A = z.infer['bb'] type B = z.infer -const { node } = zodToTs(example, 'Example') +const { node, store } = zodToTs(example, 'Example', { resolveNativeEnums: true }) console.log(printNode(node)) + +console.log('\n\nNative Enums\n---------------') +for (const e of store.nativeEnums) { + console.log(printNode(e)) +} diff --git a/test/object.test.ts b/test/object.test.ts new file mode 100644 index 0000000..924262c --- /dev/null +++ b/test/object.test.ts @@ -0,0 +1,70 @@ +/* eslint-disable no-useless-escape */ +import { expect, it } from 'vitest' +import { z } from 'zod' +import { zodToTs } from '../src' +import { printNodeTest } from './utils' + +it('supports string literal properties', () => { + const schema = z.object({ + 'string-literal': z.string(), + 5: z.number(), + }) + + const { node } = zodToTs(schema) + + expect(printNodeTest(node)).toMatchInlineSnapshot(` + "{ + \\"5\\": number; + \\"string-literal\\": string; + }" + `) +}) + +it('does not unnecessary quote identifiers', () => { + const schema = z.object({ + id: z.string(), + name: z.string(), + countryOfOrigin: z.string(), + }) + + const { node } = zodToTs(schema) + + expect(printNodeTest(node)).toMatchInlineSnapshot(` + "{ + id: string; + name: string; + countryOfOrigin: string; + }" + `) +}) + +it('escapes correctly', () => { + const schema = z.object({ + '\\': z.string(), + '"': z.string(), + "'": z.string(), + '`': z.string(), + '\n': z.number(), + '$e': z.any(), + '4t': z.any(), + '_r': z.any(), + '-r': z.undefined(), + }) + + const { node } = zodToTs(schema) + + console.log(printNodeTest(node)) + expect(printNodeTest(node)).toMatchInlineSnapshot(` + "{ + \\"\\\\\\\\\\": string; + \\"\\\\\\"\\": string; + \\"'\\": string; + \\"\`\\": string; + \\"\\\\n\\": number; + \$e?: any; + \\"4t\\"?: any; + _r?: any; + \\"-r\\"?: undefined; + }" + `) +})