perf: enable tree-shaking

This commit is contained in:
Divlo 2023-05-13 18:24:44 +02:00
parent ef5635380c
commit da5d46835d
No known key found for this signature in database
GPG Key ID: 8F9478F220CE65E9
8 changed files with 161 additions and 123 deletions

View File

@ -1,6 +1,6 @@
<!-- Please first discuss the change you wish to make via issue before making a change. It might avoid a waste of your time. --> <!-- Please first discuss the change you wish to make via issue before making a change. It might avoid a waste of your time. -->
## What changes this PR introduce? # What changes this PR introduce?
## List any relevant issue numbers ## List any relevant issue numbers

View File

@ -1,3 +1,5 @@
'use client'
import { Form, useForm } from 'react-component-form' import { Form, useForm } from 'react-component-form'
import type { HandleUseFormCallback } from 'react-component-form' import type { HandleUseFormCallback } from 'react-component-form'
import useTranslation from 'next-translate/useTranslation' import useTranslation from 'next-translate/useTranslation'
@ -8,7 +10,7 @@ import { useFormTranslation } from '../hooks/useFormTranslation'
import { userSchema } from '../models/User' import { userSchema } from '../models/User'
import { FormState } from './design/FormState' import { FormState } from './design/FormState'
const simulateServerRequest = async (ms: number): Promise<void> => { const fakeServerRequest = async (ms: number): Promise<void> => {
return await new Promise((resolve) => { return await new Promise((resolve) => {
setTimeout(resolve, ms) setTimeout(resolve, ms)
}) })
@ -23,7 +25,7 @@ export const FormExample: React.FC = () => {
formData, formData,
formElement formElement
) => { ) => {
await simulateServerRequest(2_000) await fakeServerRequest(2_000)
console.log('onSubmit:', formData) console.log('onSubmit:', formData)
formElement.reset() formElement.reset()
return { return {

View File

@ -8,9 +8,9 @@
"name": "example", "name": "example",
"version": "1.0.0", "version": "1.0.0",
"dependencies": { "dependencies": {
"@sinclair/typebox": "0.28.9", "@sinclair/typebox": "0.28.10",
"clsx": "1.2.1", "clsx": "1.2.1",
"next": "13.4.2", "next": "13.2.4",
"next-themes": "0.2.1", "next-themes": "0.2.1",
"next-translate": "2.0.5", "next-translate": "2.0.5",
"react": "18.2.0", "react": "18.2.0",
@ -19,13 +19,13 @@
}, },
"devDependencies": { "devDependencies": {
"@tsconfig/strictest": "2.0.1", "@tsconfig/strictest": "2.0.1",
"@types/node": "20.1.3", "@types/node": "20.1.4",
"@types/react": "18.2.6", "@types/react": "18.2.6",
"@types/react-dom": "18.2.4", "@types/react-dom": "18.2.4",
"autoprefixer": "10.4.14", "autoprefixer": "10.4.14",
"cypress": "12.12.0", "cypress": "12.12.0",
"eslint": "8.40.0", "eslint": "8.40.0",
"eslint-config-next": "13.4.2", "eslint-config-next": "13.2.4",
"next-translate-plugin": "2.0.5", "next-translate-plugin": "2.0.5",
"postcss": "8.4.23", "postcss": "8.4.23",
"start-server-and-test": "2.0.0", "start-server-and-test": "2.0.0",
@ -37,7 +37,7 @@
"version": "0.0.0-development", "version": "0.0.0-development",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@sinclair/typebox": "0.28.9", "@sinclair/typebox": "0.28.10",
"ajv": "8.12.0", "ajv": "8.12.0",
"ajv-formats": "2.1.1" "ajv-formats": "2.1.1"
}, },
@ -317,23 +317,53 @@
"dev": true "dev": true
}, },
"node_modules/@next/env": { "node_modules/@next/env": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.2.tgz", "resolved": "https://registry.npmjs.org/@next/env/-/env-13.2.4.tgz",
"integrity": "sha512-Wqvo7lDeS0KGwtwg9TT9wKQ8raelmUxt+TQKWvG/xKfcmDXNOtCuaszcfCF8JzlBG1q0VhpI6CKaRMbVPMDWgw==" "integrity": "sha512-+Mq3TtpkeeKFZanPturjcXt+KHfKYnLlX6jMLyCrmpq6OOs4i1GqBOAauSkii9QeKCMTYzGppar21JU57b/GEA=="
}, },
"node_modules/@next/eslint-plugin-next": { "node_modules/@next/eslint-plugin-next": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-13.4.2.tgz", "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-13.2.4.tgz",
"integrity": "sha512-ZeFWgrxwckxTpYM+ANeUL9E7LOGPbZKmI94LJIjbDU69iEIgqd4WD0l2pVbOJMr/+vgoZmJ9Dx1m0WJ7WScXHA==", "integrity": "sha512-ck1lI+7r1mMJpqLNa3LJ5pxCfOB1lfJncKmRJeJxcJqcngaFwylreLP7da6Rrjr6u2gVRTfmnkSkjc80IiQCwQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"glob": "7.1.7" "glob": "7.1.7"
} }
}, },
"node_modules/@next/swc-android-arm-eabi": {
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.2.4.tgz",
"integrity": "sha512-DWlalTSkLjDU11MY11jg17O1gGQzpRccM9Oes2yTqj2DpHndajrXHGxj9HGtJ+idq2k7ImUdJVWS2h2l/EDJOw==",
"cpu": [
"arm"
],
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-android-arm64": {
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-13.2.4.tgz",
"integrity": "sha512-sRavmUImUCf332Gy+PjIfLkMhiRX1Ez4SI+3vFDRs1N5eXp+uNzjFUK/oLMMOzk6KFSkbiK/3Wt8+dHQR/flNg==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-darwin-arm64": { "node_modules/@next/swc-darwin-arm64": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.2.tgz", "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.2.4.tgz",
"integrity": "sha512-6BBlqGu3ewgJflv9iLCwO1v1hqlecaIH2AotpKfVUEzUxuuDNJQZ2a4KLb4MBl8T9/vca1YuWhSqtbF6ZuUJJw==", "integrity": "sha512-S6vBl+OrInP47TM3LlYx65betocKUUlTZDDKzTiRDbsRESeyIkBtZ6Qi5uT2zQs4imqllJznVjFd1bXLx3Aa6A==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -346,9 +376,9 @@
} }
}, },
"node_modules/@next/swc-darwin-x64": { "node_modules/@next/swc-darwin-x64": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.2.tgz", "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.2.4.tgz",
"integrity": "sha512-iZuYr7ZvGLPjPmfhhMl0ISm+z8EiyLBC1bLyFwGBxkWmPXqdJ60mzuTaDSr5WezDwv0fz32HB7JHmRC6JVHSZg==", "integrity": "sha512-a6LBuoYGcFOPGd4o8TPo7wmv5FnMr+Prz+vYHopEDuhDoMSHOnC+v+Ab4D7F0NMZkvQjEJQdJS3rqgFhlZmKlw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -360,10 +390,40 @@
"node": ">= 10" "node": ">= 10"
} }
}, },
"node_modules/@next/swc-freebsd-x64": {
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.2.4.tgz",
"integrity": "sha512-kkbzKVZGPaXRBPisoAQkh3xh22r+TD+5HwoC5bOkALraJ0dsOQgSMAvzMXKsN3tMzJUPS0tjtRf1cTzrQ0I5vQ==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-linux-arm-gnueabihf": {
"version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.2.4.tgz",
"integrity": "sha512-7qA1++UY0fjprqtjBZaOA6cas/7GekpjVsZn/0uHvquuITFCdKGFCsKNBx3S0Rpxmx6WYo0GcmhNRM9ru08BGg==",
"cpu": [
"arm"
],
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-linux-arm64-gnu": { "node_modules/@next/swc-linux-arm64-gnu": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.2.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.2.4.tgz",
"integrity": "sha512-2xVabFtIge6BJTcJrW8YuUnYTuQjh4jEuRuS2mscyNVOj6zUZkom3CQg+egKOoS+zh2rrro66ffSKIS+ztFJTg==", "integrity": "sha512-xzYZdAeq883MwXgcwc72hqo/F/dwUxCukpDOkx/j1HTq/J0wJthMGjinN9wH5bPR98Mfeh1MZJ91WWPnZOedOg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -376,9 +436,9 @@
} }
}, },
"node_modules/@next/swc-linux-arm64-musl": { "node_modules/@next/swc-linux-arm64-musl": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.2.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.2.4.tgz",
"integrity": "sha512-wKRCQ27xCUJx5d6IivfjYGq8oVngqIhlhSAJntgXLt7Uo9sRT/3EppMHqUZRfyuNBTbykEre1s5166z+pvRB5A==", "integrity": "sha512-8rXr3WfmqSiYkb71qzuDP6I6R2T2tpkmf83elDN8z783N9nvTJf2E7eLx86wu2OJCi4T05nuxCsh4IOU3LQ5xw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -391,9 +451,9 @@
} }
}, },
"node_modules/@next/swc-linux-x64-gnu": { "node_modules/@next/swc-linux-x64-gnu": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.2.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.2.4.tgz",
"integrity": "sha512-NpCa+UVhhuNeaFVUP1Bftm0uqtvLWq2JTm7+Ta48+2Uqj2mNXrDIvyn1DY/ZEfmW/1yvGBRaUAv9zkMkMRixQA==", "integrity": "sha512-Ngxh51zGSlYJ4EfpKG4LI6WfquulNdtmHg1yuOYlaAr33KyPJp4HeN/tivBnAHcZkoNy0hh/SbwDyCnz5PFJQQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -406,9 +466,9 @@
} }
}, },
"node_modules/@next/swc-linux-x64-musl": { "node_modules/@next/swc-linux-x64-musl": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.2.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.2.4.tgz",
"integrity": "sha512-ZWVC72x0lW4aj44e3khvBrj2oSYj1bD0jESmyah3zG/3DplEy/FOtYkMzbMjHTdDSheso7zH8GIlW6CDQnKhmQ==", "integrity": "sha512-gOvwIYoSxd+j14LOcvJr+ekd9fwYT1RyMAHOp7znA10+l40wkFiMONPLWiZuHxfRk+Dy7YdNdDh3ImumvL6VwA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -421,9 +481,9 @@
} }
}, },
"node_modules/@next/swc-win32-arm64-msvc": { "node_modules/@next/swc-win32-arm64-msvc": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.2.tgz", "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.2.4.tgz",
"integrity": "sha512-pLT+OWYpzJig5K4VKhLttlIfBcVZfr2+Xbjra0Tjs83NQSkFS+y7xx+YhCwvpEmXYLIvaggj2ONPyjbiigOvHQ==", "integrity": "sha512-q3NJzcfClgBm4HvdcnoEncmztxrA5GXqKeiZ/hADvC56pwNALt3ngDC6t6qr1YW9V/EPDxCYeaX4zYxHciW4Dw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -436,9 +496,9 @@
} }
}, },
"node_modules/@next/swc-win32-ia32-msvc": { "node_modules/@next/swc-win32-ia32-msvc": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.2.tgz", "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.2.4.tgz",
"integrity": "sha512-dhpiksQCyGca4WY0fJyzK3FxMDFoqMb0Cn+uDB+9GYjpU2K5//UGPQlCwiK4JHxuhg8oLMag5Nf3/IPSJNG8jw==", "integrity": "sha512-/eZ5ncmHUYtD2fc6EUmAIZlAJnVT2YmxDsKs1Ourx0ttTtvtma/WKlMV5NoUsyOez0f9ExLyOpeCoz5aj+MPXw==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@ -451,9 +511,9 @@
} }
}, },
"node_modules/@next/swc-win32-x64-msvc": { "node_modules/@next/swc-win32-x64-msvc": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.2.tgz", "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.2.4.tgz",
"integrity": "sha512-O7bort1Vld00cu8g0jHZq3cbSTUNMohOEvYqsqE10+yfohhdPHzvzO+ziJRz4Dyyr/fYKREwS7gR4JC0soSOMw==", "integrity": "sha512-0MffFmyv7tBLlji01qc0IaPP/LVExzvj7/R5x1Jph1bTAIj4Vu81yFQWHHQAP6r4ff9Ukj1mBK6MDNVXm7Tcvw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -548,14 +608,14 @@
"dev": true "dev": true
}, },
"node_modules/@sinclair/typebox": { "node_modules/@sinclair/typebox": {
"version": "0.28.9", "version": "0.28.10",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.28.9.tgz", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.28.10.tgz",
"integrity": "sha512-m98m37J9CBZ8XinStjpss2ZOW50KG45XB4cAva2NGoQHiGPxhfNL2BzUXYCs6ahXdK7/F1NIjOGh+MPP5dK8Rw==" "integrity": "sha512-ZRpJZFpr2yq1vAenq2qspUKs34CBC97LOMghUuTTEveFONVExQAYEB8Tcjy9NlPj8oVlSysK15Hzkf7Ox6x3lA=="
}, },
"node_modules/@swc/helpers": { "node_modules/@swc/helpers": {
"version": "0.5.1", "version": "0.4.14",
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.1.tgz", "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.14.tgz",
"integrity": "sha512-sJ902EfIzn1Fa+qYmjdQqh8tPsoxyBz+8yBKC2HKUxyezKJFwPGOn7pv4WY6QuQW//ySQi5lJjA/ZT9sNWWNTg==", "integrity": "sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==",
"dependencies": { "dependencies": {
"tslib": "^2.4.0" "tslib": "^2.4.0"
} }
@ -573,9 +633,9 @@
"dev": true "dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "20.1.3", "version": "20.1.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.3.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.4.tgz",
"integrity": "sha512-NP2yfZpgmf2eDRPmgGq+fjGjSwFgYbihA8/gK+ey23qT9RkxsgNTZvGOEpXgzIGqesTYkElELLgtKoMQTys5vA==", "integrity": "sha512-At4pvmIOki8yuwLtd7BNHl3CiWNbtclUbNtScGx4OHfBd4/oWoJC8KRCIxXwkdndzhxOsPXihrsOoydxBjlE9Q==",
"dev": true "dev": true
}, },
"node_modules/@types/prop-types": { "node_modules/@types/prop-types": {
@ -1324,17 +1384,6 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/busboy": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
"integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==",
"dependencies": {
"streamsearch": "^1.1.0"
},
"engines": {
"node": ">=10.16.0"
}
},
"node_modules/cachedir": { "node_modules/cachedir": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.3.0.tgz", "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.3.0.tgz",
@ -1712,9 +1761,9 @@
} }
}, },
"node_modules/cypress/node_modules/@types/node": { "node_modules/cypress/node_modules/@types/node": {
"version": "14.18.46", "version": "14.18.47",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.46.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.47.tgz",
"integrity": "sha512-n4yVT5FuY5NCcGHCosQSGvvCT74HhowymPN2OEcsHPw6U1NuxV9dvxWbrM2dnBukWjdMYzig1WfIkWdTTQJqng==", "integrity": "sha512-OuJi8bIng4wYHHA3YpKauL58dZrPxro3d0tabPHyiNF8rKfGKuVfr83oFlPLmKri1cX+Z3cJP39GXmnqkP11Gw==",
"dev": true "dev": true
}, },
"node_modules/damerau-levenshtein": { "node_modules/damerau-levenshtein": {
@ -2271,12 +2320,12 @@
} }
}, },
"node_modules/eslint-config-next": { "node_modules/eslint-config-next": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-13.4.2.tgz", "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-13.2.4.tgz",
"integrity": "sha512-zjLJ9B9bbeWSo5q+iHfdt8gVYyT+y2BpWDfjR6XMBtFRSMKRGjllDKxnuKBV1q2Y/QpwLM2PXHJTMRyblCmRAg==", "integrity": "sha512-lunIBhsoeqw6/Lfkd6zPt25w1bn0znLA/JCL+au1HoEpSb4/PpsOYsYtgV/q+YPsoKIOzFyU5xnb04iZnXjUvg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@next/eslint-plugin-next": "13.4.2", "@next/eslint-plugin-next": "13.2.4",
"@rushstack/eslint-patch": "^1.1.3", "@rushstack/eslint-patch": "^1.1.3",
"@typescript-eslint/parser": "^5.42.0", "@typescript-eslint/parser": "^5.42.0",
"eslint-import-resolver-node": "^0.3.6", "eslint-import-resolver-node": "^0.3.6",
@ -4345,37 +4394,39 @@
"dev": true "dev": true
}, },
"node_modules/next": { "node_modules/next": {
"version": "13.4.2", "version": "13.2.4",
"resolved": "https://registry.npmjs.org/next/-/next-13.4.2.tgz", "resolved": "https://registry.npmjs.org/next/-/next-13.2.4.tgz",
"integrity": "sha512-aNFqLs3a3nTGvLWlO9SUhCuMUHVPSFQC0+tDNGAsDXqx+WJDFSbvc233gOJ5H19SBc7nw36A9LwQepOJ2u/8Kg==", "integrity": "sha512-g1I30317cThkEpvzfXujf0O4wtaQHtDCLhlivwlTJ885Ld+eOgcz7r3TGQzeU+cSRoNHtD8tsJgzxVdYojFssw==",
"dependencies": { "dependencies": {
"@next/env": "13.4.2", "@next/env": "13.2.4",
"@swc/helpers": "0.5.1", "@swc/helpers": "0.4.14",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406", "caniuse-lite": "^1.0.30001406",
"postcss": "8.4.14", "postcss": "8.4.14",
"styled-jsx": "5.1.1", "styled-jsx": "5.1.1"
"zod": "3.21.4"
}, },
"bin": { "bin": {
"next": "dist/bin/next" "next": "dist/bin/next"
}, },
"engines": { "engines": {
"node": ">=16.8.0" "node": ">=14.6.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"@next/swc-darwin-arm64": "13.4.2", "@next/swc-android-arm-eabi": "13.2.4",
"@next/swc-darwin-x64": "13.4.2", "@next/swc-android-arm64": "13.2.4",
"@next/swc-linux-arm64-gnu": "13.4.2", "@next/swc-darwin-arm64": "13.2.4",
"@next/swc-linux-arm64-musl": "13.4.2", "@next/swc-darwin-x64": "13.2.4",
"@next/swc-linux-x64-gnu": "13.4.2", "@next/swc-freebsd-x64": "13.2.4",
"@next/swc-linux-x64-musl": "13.4.2", "@next/swc-linux-arm-gnueabihf": "13.2.4",
"@next/swc-win32-arm64-msvc": "13.4.2", "@next/swc-linux-arm64-gnu": "13.2.4",
"@next/swc-win32-ia32-msvc": "13.4.2", "@next/swc-linux-arm64-musl": "13.2.4",
"@next/swc-win32-x64-msvc": "13.4.2" "@next/swc-linux-x64-gnu": "13.2.4",
"@next/swc-linux-x64-musl": "13.2.4",
"@next/swc-win32-arm64-msvc": "13.2.4",
"@next/swc-win32-ia32-msvc": "13.2.4",
"@next/swc-win32-x64-msvc": "13.2.4"
}, },
"peerDependencies": { "peerDependencies": {
"@opentelemetry/api": "^1.1.0", "@opentelemetry/api": "^1.4.0",
"fibers": ">= 3.1.0", "fibers": ">= 3.1.0",
"node-sass": "^6.0.0 || ^7.0.0", "node-sass": "^6.0.0 || ^7.0.0",
"react": "^18.2.0", "react": "^18.2.0",
@ -5610,14 +5661,6 @@
"duplexer": "~0.1.1" "duplexer": "~0.1.1"
} }
}, },
"node_modules/streamsearch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
"integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==",
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/string-width": { "node_modules/string-width": {
"version": "4.2.3", "version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
@ -6362,14 +6405,6 @@
"funding": { "funding": {
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
},
"node_modules/zod": {
"version": "3.21.4",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz",
"integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
} }
} }
} }

View File

@ -11,9 +11,9 @@
"test:dev": "start-server-and-test \"dev\" \"http://127.0.0.1:3000\" \"cypress open\"" "test:dev": "start-server-and-test \"dev\" \"http://127.0.0.1:3000\" \"cypress open\""
}, },
"dependencies": { "dependencies": {
"@sinclair/typebox": "0.28.9", "@sinclair/typebox": "0.28.10",
"clsx": "1.2.1", "clsx": "1.2.1",
"next": "13.4.2", "next": "13.2.4",
"next-themes": "0.2.1", "next-themes": "0.2.1",
"next-translate": "2.0.5", "next-translate": "2.0.5",
"react": "18.2.0", "react": "18.2.0",
@ -22,13 +22,13 @@
}, },
"devDependencies": { "devDependencies": {
"@tsconfig/strictest": "2.0.1", "@tsconfig/strictest": "2.0.1",
"@types/node": "20.1.3", "@types/node": "20.1.4",
"@types/react": "18.2.6", "@types/react": "18.2.6",
"@types/react-dom": "18.2.4", "@types/react-dom": "18.2.4",
"autoprefixer": "10.4.14", "autoprefixer": "10.4.14",
"cypress": "12.12.0", "cypress": "12.12.0",
"eslint": "8.40.0", "eslint": "8.40.0",
"eslint-config-next": "13.4.2", "eslint-config-next": "13.2.4",
"next-translate-plugin": "2.0.5", "next-translate-plugin": "2.0.5",
"postcss": "8.4.23", "postcss": "8.4.23",
"start-server-and-test": "2.0.0", "start-server-and-test": "2.0.0",

14
package-lock.json generated
View File

@ -9,7 +9,7 @@
"version": "0.0.0-development", "version": "0.0.0-development",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@sinclair/typebox": "0.28.9", "@sinclair/typebox": "0.28.10",
"ajv": "8.12.0", "ajv": "8.12.0",
"ajv-formats": "2.1.1" "ajv-formats": "2.1.1"
}, },
@ -3112,9 +3112,9 @@
} }
}, },
"node_modules/@sinclair/typebox": { "node_modules/@sinclair/typebox": {
"version": "0.28.9", "version": "0.28.10",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.28.9.tgz", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.28.10.tgz",
"integrity": "sha512-m98m37J9CBZ8XinStjpss2ZOW50KG45XB4cAva2NGoQHiGPxhfNL2BzUXYCs6ahXdK7/F1NIjOGh+MPP5dK8Rw==" "integrity": "sha512-ZRpJZFpr2yq1vAenq2qspUKs34CBC97LOMghUuTTEveFONVExQAYEB8Tcjy9NlPj8oVlSysK15Hzkf7Ox6x3lA=="
}, },
"node_modules/@sinonjs/commons": { "node_modules/@sinonjs/commons": {
"version": "3.0.0", "version": "3.0.0",
@ -3362,9 +3362,9 @@
"dev": true "dev": true
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "20.1.3", "version": "20.1.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.3.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.4.tgz",
"integrity": "sha512-NP2yfZpgmf2eDRPmgGq+fjGjSwFgYbihA8/gK+ey23qT9RkxsgNTZvGOEpXgzIGqesTYkElELLgtKoMQTys5vA==", "integrity": "sha512-At4pvmIOki8yuwLtd7BNHl3CiWNbtclUbNtScGx4OHfBd4/oWoJC8KRCIxXwkdndzhxOsPXihrsOoydxBjlE9Q==",
"dev": true "dev": true
}, },
"node_modules/@types/normalize-package-data": { "node_modules/@types/normalize-package-data": {

View File

@ -18,10 +18,10 @@
"url": "https://github.com/Divlo/react-component-form/issues" "url": "https://github.com/Divlo/react-component-form/issues"
}, },
"homepage": "https://react-component-form.vercel.app/", "homepage": "https://react-component-form.vercel.app/",
"main": "dist/index.js", "main": "build/index.js",
"types": "dist/index.d.ts", "types": "build/index.d.ts",
"files": [ "files": [
"dist" "build"
], ],
"publishConfig": { "publishConfig": {
"access": "public", "access": "public",
@ -41,7 +41,7 @@
"react": ">=18.2.0" "react": ">=18.2.0"
}, },
"dependencies": { "dependencies": {
"@sinclair/typebox": "0.28.9", "@sinclair/typebox": "0.28.10",
"ajv": "8.12.0", "ajv": "8.12.0",
"ajv-formats": "2.1.1" "ajv-formats": "2.1.1"
}, },

View File

@ -29,14 +29,14 @@ describe('<Form />', () => {
const text = 'some random text' const text = 'some random text'
fireEvent.change(inputForm, { target: { value: text } }) fireEvent.change(inputForm, { target: { value: text } })
expect(formData.inputName).toEqual(text) expect(formData['inputName']).toEqual(text)
expect(formElement instanceof HTMLFormElement).toBeTruthy() expect(formElement instanceof HTMLFormElement).toBeTruthy()
formData = {} formData = {}
formElement = null formElement = null
fireEvent.click(buttonSubmit) fireEvent.click(buttonSubmit)
expect(Object.keys(formData).length).toEqual(1) expect(Object.keys(formData).length).toEqual(1)
expect(formData.inputName).toEqual(text) expect(formData['inputName']).toEqual(text)
expect(formElement instanceof HTMLFormElement).toBeTruthy() expect(formElement instanceof HTMLFormElement).toBeTruthy()
}) })
}) })

View File

@ -1,12 +1,13 @@
import { defineConfig } from 'tsup' import { defineConfig } from 'tsup'
export default defineConfig({ export default defineConfig({
entry: ['src/index.ts'], entry: ['src/**/*.{ts,tsx}', '!src/**/*.test.{ts,tsx}'],
sourcemap: true, sourcemap: false,
clean: true, clean: true,
platform: 'browser', platform: 'browser',
target: 'esnext', target: 'esnext',
format: ['esm'], format: ['esm'],
minify: true, minify: false,
outDir: 'build',
dts: true dts: true
}) })