diff --git a/benchmark/src/framework.mock.ts b/benchmark/src/framework.mock.ts index 6a7cca81..690129b1 100644 --- a/benchmark/src/framework.mock.ts +++ b/benchmark/src/framework.mock.ts @@ -1,5 +1,5 @@ import { FrameworkContract } from '@h4ad/serverless-adapter'; -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; import { ObjectReadableMock } from 'stream-mock'; /** diff --git a/package-lock.json b/package-lock.json index a00c5535..b44a5547 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "@microsoft/api-extractor": "7.39.0", "@microsoft/api-extractor-model": "7.28.3", "@microsoft/tsdoc": "0.14.2", + "@npmcli/package-json": "5.0.0", "@rushstack/node-core-library": "3.62.0", "@trpc/server": "10.44.1", "@types/aws-lambda": "8.10.130", @@ -38,6 +39,7 @@ "commitizen": "4.3.0", "cors": "2.8.5", "cz-conventional-changelog": "3.3.0", + "esbuild": "0.19.10", "eslint": "8.56.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.29.1", @@ -55,6 +57,7 @@ "stream-mock": "2.0.5", "supertest": "6.3.3", "ts-node": "10.9.2", + "tsup": "8.0.1", "typedoc": "0.25.4", "typescript": "~5.3.3", "vite": "5.0.10", @@ -1310,6 +1313,262 @@ "@deepkit/type": "^1.0.1-alpha.13" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.10.tgz", + "integrity": "sha512-Q+mk96KJ+FZ30h9fsJl+67IjNJm3x2eX+GBWGmocAKgzp27cowCOOqSdscX80s0SpdFXZnIv/+1xD1EctFx96Q==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.10.tgz", + "integrity": "sha512-7W0bK7qfkw1fc2viBfrtAEkDKHatYfHzr/jKAHNr9BvkYDXPcC6bodtm8AyLJNNuqClLNaeTLuwURt4PRT9d7w==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.10.tgz", + "integrity": "sha512-1X4CClKhDgC3by7k8aOWZeBXQX8dHT5QAMCAQDArCLaYfkppoARvh0fit3X2Qs+MXDngKcHv6XXyQCpY0hkK1Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.10.tgz", + "integrity": "sha512-O/nO/g+/7NlitUxETkUv/IvADKuZXyH4BHf/g/7laqKC4i/7whLpB0gvpPc2zpF0q9Q6FXS3TS75QHac9MvVWw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.10.tgz", + "integrity": "sha512-YSRRs2zOpwypck+6GL3wGXx2gNP7DXzetmo5pHXLrY/VIMsS59yKfjPizQ4lLt5vEI80M41gjm2BxrGZ5U+VMA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.10.tgz", + "integrity": "sha512-alfGtT+IEICKtNE54hbvPg13xGBe4GkVxyGWtzr+yHO7HIiRJppPDhOKq3zstTcVf8msXb/t4eavW3jCDpMSmA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.10.tgz", + "integrity": "sha512-dMtk1wc7FSH8CCkE854GyGuNKCewlh+7heYP/sclpOG6Cectzk14qdUIY5CrKDbkA/OczXq9WesqnPl09mj5dg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.10.tgz", + "integrity": "sha512-G5UPPspryHu1T3uX8WiOEUa6q6OlQh6gNl4CO4Iw5PS+Kg5bVggVFehzXBJY6X6RSOMS8iXDv2330VzaObm4Ag==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.10.tgz", + "integrity": "sha512-j6gUW5aAaPgD416Hk9FHxn27On28H4eVI9rJ4az7oCGTFW48+LcgNDBN+9f8rKZz7EEowo889CPKyeaD0iw9Kg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.10.tgz", + "integrity": "sha512-QxaouHWZ+2KWEj7cGJmvTIHVALfhpGxo3WLmlYfJ+dA5fJB6lDEIg+oe/0//FuyVHuS3l79/wyBxbHr0NgtxJQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.10.tgz", + "integrity": "sha512-4ub1YwXxYjj9h1UIZs2hYbnTZBtenPw5NfXCRgEkGb0b6OJ2gpkMvDqRDYIDRjRdWSe/TBiZltm3Y3Q8SN1xNg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.10.tgz", + "integrity": "sha512-lo3I9k+mbEKoxtoIbM0yC/MZ1i2wM0cIeOejlVdZ3D86LAcFXFRdeuZmh91QJvUTW51bOK5W2BznGNIl4+mDaA==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.10.tgz", + "integrity": "sha512-J4gH3zhHNbdZN0Bcr1QUGVNkHTdpijgx5VMxeetSk6ntdt+vR1DqGmHxQYHRmNb77tP6GVvD+K0NyO4xjd7y4A==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.10.tgz", + "integrity": "sha512-tgT/7u+QhV6ge8wFMzaklOY7KqiyitgT1AUHMApau32ZlvTB/+efeCtMk4eXS+uEymYK249JsoiklZN64xt6oQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.10.tgz", + "integrity": "sha512-0f/spw0PfBMZBNqtKe5FLzBDGo0SKZKvMl5PHYQr3+eiSscfJ96XEknCe+JoOayybWUFQbcJTrk946i3j9uYZA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.10.tgz", + "integrity": "sha512-pZFe0OeskMHzHa9U38g+z8Yx5FNCLFtUnJtQMpwhS+r4S566aK2ci3t4NCP4tjt6d5j5uo4h7tExZMjeKoehAA==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/linux-x64": { "version": "0.19.10", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.10.tgz", @@ -1326,6 +1585,102 @@ "node": ">=12" } }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.10.tgz", + "integrity": "sha512-ACbZ0vXy9zksNArWlk2c38NdKg25+L9pr/mVaj9SUq6lHZu/35nx2xnQVRGLrC1KKQqJKRIB0q8GspiHI3J80Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.10.tgz", + "integrity": "sha512-PxcgvjdSjtgPMiPQrM3pwSaG4kGphP+bLSb+cihuP0LYdZv1epbAIecHVl5sD3npkfYBZ0ZnOjR878I7MdJDFg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.10.tgz", + "integrity": "sha512-ZkIOtrRL8SEJjr+VHjmW0znkPs+oJXhlJbNwfI37rvgeMtk3sxOQevXPXjmAPZPigVTncvFqLMd+uV0IBSEzqA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.10.tgz", + "integrity": "sha512-+Sa4oTDbpBfGpl3Hn3XiUe4f8TU2JF7aX8cOfqFYMMjXp6ma6NJDztl5FDG8Ezx0OjwGikIHw+iA54YLDNNVfw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.10.tgz", + "integrity": "sha512-EOGVLK1oWMBXgfttJdPHDTiivYSjX6jDNaATeNOaCOFEVcfMjtbx7WVQwPSE1eIfCp/CaSF2nSrDtzc4I9f8TQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.10", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.10.tgz", + "integrity": "sha512-whqLG6Sc70AbU73fFYvuYzaE4MNMBIlR1Y/IrUeOXFrWHxBEjjbZaQ3IXIQS8wJdAzue2GwYZCjOrgrU1oUHoA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "dev": true, @@ -2379,6 +2734,18 @@ "node": ">=6.0.0" } }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", + "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.14", "dev": true, @@ -2530,6 +2897,121 @@ "node": ">= 8" } }, + "node_modules/@npmcli/git": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-5.0.3.tgz", + "integrity": "sha512-UZp9NwK+AynTrKvHn5k3KviW/hA5eENmFsu3iAPe7sWRt0lFUdsY/wXIYjpDFe7cdSNwOIzbObfwgt6eL5/2zw==", + "dev": true, + "dependencies": { + "@npmcli/promise-spawn": "^7.0.0", + "lru-cache": "^10.0.1", + "npm-pick-manifest": "^9.0.0", + "proc-log": "^3.0.0", + "promise-inflight": "^1.0.1", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^4.0.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/git/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/@npmcli/git/node_modules/lru-cache": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", + "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", + "dev": true, + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/@npmcli/git/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "dev": true, + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/package-json": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-5.0.0.tgz", + "integrity": "sha512-OI2zdYBLhQ7kpNPaJxiflofYIpkNLi+lnGdzqUOfRmCF3r2l1nadcjtCYMJKv/Utm/ZtlffaUuTiAktPHbc17g==", + "dev": true, + "dependencies": { + "@npmcli/git": "^5.0.0", + "glob": "^10.2.2", + "hosted-git-info": "^7.0.0", + "json-parse-even-better-errors": "^3.0.0", + "normalize-package-data": "^6.0.0", + "proc-log": "^3.0.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/package-json/node_modules/json-parse-even-better-errors": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.1.tgz", + "integrity": "sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/promise-spawn": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-7.0.0.tgz", + "integrity": "sha512-wBqcGsMELZna0jDblGd7UXgOby45TQaMWmbFwWX+SEotk4HV6zG2t6rT9siyLhPk4P6YYqgfL1UO8nMWDBVJXQ==", + "dev": true, + "dependencies": { + "which": "^4.0.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/promise-spawn/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/@npmcli/promise-spawn/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "dev": true, + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, "node_modules/@oclif/command": { "version": "1.8.24", "dev": true, @@ -3943,6 +4425,25 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/archy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", @@ -4219,6 +4720,15 @@ "node": "*" } }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/bl": { "version": "4.1.0", "dev": true, @@ -4360,6 +4870,23 @@ "dev": true, "license": "BSD-3-Clause" }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/builtins": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.0.1.tgz", + "integrity": "sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==", + "dev": true, + "dependencies": { + "semver": "^7.0.0" + } + }, "node_modules/bundle-name": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", @@ -4375,6 +4902,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/bundle-require": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-4.0.2.tgz", + "integrity": "sha512-jwzPOChofl67PSTW2SGubV9HBQAhhR2i6nskiOThauo9dzwDUgOWQScFVaJkjEfYX+UXiD+LEx8EblQMc2wIag==", + "dev": true, + "dependencies": { + "load-tsconfig": "^0.2.3" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "esbuild": ">=0.17" + } + }, "node_modules/bytes": { "version": "3.1.2", "dev": true, @@ -4505,6 +5047,45 @@ "node": "*" } }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/cli-cursor": { "version": "3.1.0", "dev": true, @@ -5554,6 +6135,12 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "dev": true + }, "node_modules/error-ex": { "version": "1.3.2", "dev": true, @@ -6937,11 +7524,25 @@ "node": ">=6 <7 || >=8" } }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "dev": true, - "license": "ISC" - }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -7516,6 +8117,27 @@ "node": ">=0.10.0" } }, + "node_modules/hosted-git-info": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.1.tgz", + "integrity": "sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==", + "dev": true, + "dependencies": { + "lru-cache": "^10.0.1" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/hosted-git-info/node_modules/lru-cache": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", + "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", + "dev": true, + "engines": { + "node": "14 || >=16.14" + } + }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -7884,6 +8506,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-boolean-object": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", @@ -8307,6 +8941,15 @@ "url": "https://github.com/sponsors/panva" } }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -8601,6 +9244,15 @@ "integrity": "sha512-n9wh8tvBe5sFmsqlg+XQhaQLumwpqoAUruLwjCopgTmUBjJ/fjtBsJzKleCaIGBOMXYEhp1YfKl4d7rJ5ZKJGA==", "dev": true }, + "node_modules/lilconfig": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.0.0.tgz", + "integrity": "sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==", + "dev": true, + "engines": { + "node": ">=14" + } + }, "node_modules/limiter": { "version": "1.1.5", "dev": true @@ -8620,6 +9272,15 @@ "uc.micro": "^1.0.1" } }, + "node_modules/load-tsconfig": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz", + "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/local-pkg": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.0.tgz", @@ -9072,6 +9733,17 @@ "dev": true, "license": "ISC" }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, "node_modules/nanoid": { "version": "3.3.7", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", @@ -9179,6 +9851,81 @@ "node": ">= 6.13.0" } }, + "node_modules/normalize-package-data": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.0.tgz", + "integrity": "sha512-UL7ELRVxYBHBgYEtZCXjxuD5vPxnmvMGq0jp/dGPKKrN7tfsBh2IY7TlJ15WWwdjRWD3RJbnsygUurTK3xkPkg==", + "dev": true, + "dependencies": { + "hosted-git-info": "^7.0.0", + "is-core-module": "^2.8.1", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-install-checks": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.3.0.tgz", + "integrity": "sha512-W29RiK/xtpCGqn6f3ixfRYGk+zRyr+Ew9F2E20BfXxT5/euLdA/Nm7fO7OeTGuAmTs30cpgInyJ0cYe708YTZw==", + "dev": true, + "dependencies": { + "semver": "^7.1.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm-normalize-package-bin": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-3.0.1.tgz", + "integrity": "sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm-package-arg": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-11.0.1.tgz", + "integrity": "sha512-M7s1BD4NxdAvBKUPqqRW957Xwcl/4Zvo8Aj+ANrzvIPzGJZElrH7Z//rSaec2ORcND6FHHLnZeY8qgTpXDMFQQ==", + "dev": true, + "dependencies": { + "hosted-git-info": "^7.0.0", + "proc-log": "^3.0.0", + "semver": "^7.3.5", + "validate-npm-package-name": "^5.0.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/npm-pick-manifest": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-9.0.0.tgz", + "integrity": "sha512-VfvRSs/b6n9ol4Qb+bDwNGUXutpy76x6MARw/XssevE0TnctIKcmklJZM5Z7nqs5z5aW+0S63pgCNbpkUNNXBg==", + "dev": true, + "dependencies": { + "npm-install-checks": "^6.0.0", + "npm-normalize-package-bin": "^3.0.0", + "npm-package-arg": "^11.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, "node_modules/npm-run-path": { "version": "4.0.1", "dev": true, @@ -9744,6 +10491,41 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/postcss-load-config": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.2.tgz", + "integrity": "sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "lilconfig": "^3.0.0", + "yaml": "^2.3.4" + }, + "engines": { + "node": ">= 14" + }, + "peerDependencies": { + "postcss": ">=8.0.9", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -9805,6 +10587,15 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/proc-log": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-3.0.0.tgz", + "integrity": "sha512-++Vn7NS4Xf9NacaU9Xq3URUuqZETPsf8L4j5/ckhaRYsfPeRyzGw+iDjFhV/Jr3uNmTvvddEJFWh5R1gRgUH8A==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -9820,6 +10611,34 @@ "integrity": "sha512-mqn0kFRl0EoqhnL0GQ0veqFHyIN1yig9RHh/InzORTUiZHFRAur+aMtRkELNwGs9aNwKS6tg/An4NYBPGwvtzQ==", "dev": true }, + "node_modules/promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==", + "dev": true + }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dev": true, + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/promise-retry/node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/proto3-json-serializer": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/proto3-json-serializer/-/proto3-json-serializer-1.1.1.tgz", @@ -10116,6 +10935,18 @@ "node": ">= 6" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/real-require": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", @@ -10224,7 +11055,6 @@ "version": "5.0.0", "dev": true, "license": "MIT", - "optional": true, "engines": { "node": ">=8" } @@ -10721,6 +11551,18 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "node_modules/spdx-correct": { "version": "3.1.1", "dev": true, @@ -10981,6 +11823,37 @@ "dev": true, "license": "MIT" }, + "node_modules/sucrase": { + "version": "3.35.0", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", + "integrity": "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "glob": "^10.3.10", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/sucrase/node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/superagent": { "version": "8.0.9", "dev": true, @@ -11098,6 +11971,34 @@ "node": ">=10" } }, + "node_modules/terser": { + "version": "5.26.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.26.0.tgz", + "integrity": "sha512-dytTGoE2oHgbNV9nTzgBEPaqAWvcJNl66VZ0BkJqlvp71IjO8CxdBx/ykCNb47cLnCmCvRZ6ZR0tLkqvZCdVBQ==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -11142,6 +12043,27 @@ "dev": true, "license": "MIT" }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/thread-stream": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-2.4.1.tgz", @@ -11240,6 +12162,24 @@ "node": ">=0.6" } }, + "node_modules/tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "bin": { + "tree-kill": "cli.js" + } + }, "node_modules/ts-api-utils": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", @@ -11252,6 +12192,12 @@ "typescript": ">=4.2.0" } }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true + }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", @@ -11330,6 +12276,67 @@ "node": ">=0.6.x" } }, + "node_modules/tsup": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.0.1.tgz", + "integrity": "sha512-hvW7gUSG96j53ZTSlT4j/KL0q1Q2l6TqGBFc6/mu/L46IoNWqLLUzLRLP1R8Q7xrJTmkDxxDoojV5uCVs1sVOg==", + "dev": true, + "dependencies": { + "bundle-require": "^4.0.0", + "cac": "^6.7.12", + "chokidar": "^3.5.1", + "debug": "^4.3.1", + "esbuild": "^0.19.2", + "execa": "^5.0.0", + "globby": "^11.0.3", + "joycon": "^3.0.1", + "postcss-load-config": "^4.0.1", + "resolve-from": "^5.0.0", + "rollup": "^4.0.2", + "source-map": "0.8.0-beta.0", + "sucrase": "^3.20.3", + "tree-kill": "^1.2.2" + }, + "bin": { + "tsup": "dist/cli-default.js", + "tsup-node": "dist/cli-node.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@microsoft/api-extractor": "^7.36.0", + "@swc/core": "^1", + "postcss": "^8.4.12", + "typescript": ">=4.5.0" + }, + "peerDependenciesMeta": { + "@microsoft/api-extractor": { + "optional": true + }, + "@swc/core": { + "optional": true + }, + "postcss": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/tsup/node_modules/source-map": { + "version": "0.8.0-beta.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.8.0-beta.0.tgz", + "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==", + "dev": true, + "dependencies": { + "whatwg-url": "^7.0.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -11644,6 +12651,18 @@ "spdx-expression-parse": "^3.0.0" } }, + "node_modules/validate-npm-package-name": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.0.tgz", + "integrity": "sha512-YuKoXDAhBYxY7SfOKxHBDoSyENFeW5VvIIQp2TGQuit8gpK6MnWaQelBKxso72DoxTZfZdcP3W90LqpSkgPzLQ==", + "dev": true, + "dependencies": { + "builtins": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/validator": { "version": "13.11.0", "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", @@ -11955,6 +12974,12 @@ "defaults": "^1.0.3" } }, + "node_modules/webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true + }, "node_modules/websocket-driver": { "version": "0.7.4", "dev": true, @@ -11984,6 +13009,17 @@ "node": ">=12" } }, + "node_modules/whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "dev": true, + "dependencies": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, "node_modules/which": { "version": "1.3.1", "dev": true, @@ -12142,6 +13178,15 @@ "dev": true, "license": "ISC" }, + "node_modules/yaml": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, "node_modules/yargs": { "version": "17.7.2", "dev": true, diff --git a/package.json b/package.json index c1f20030..d9b037ed 100644 --- a/package.json +++ b/package.json @@ -2,22 +2,25 @@ "name": "@h4ad/serverless-adapter", "version": "3.1.0", "description": "Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Digital Ocean and many other clouds.", - "main": "./lib/index.js", + "type": "module", + "main": "./lib/index.cjs", + "module": "./lib/index.js", + "types": "./lib/index.d.cts", "files": [ "lib/**/*" ], "scripts": { "prepare": "husky install", - "build": "vite build && tsc -p tsconfig.build.json --emitDeclarationOnly", - "build:docs": "tsc -p tsconfig.doc.json --emitDeclarationOnly", + "build": "tsup", + "build:docs": "tsc -p tsconfig.doc.json", "clean": "rm -rf ./lib/", "cm": "cz", "coverage": "codecov", "lint": "eslint ./src/ ./test/ --fix", "docs:generate": "npm run docs:generate:parsing && npm run docs:generate:markdown && npm run docs:generate:api-pages", - "docs:generate:parsing": "npm run build:docs && ts-node scripts/parse-docs.ts", - "docs:generate:markdown": "ts-node scripts/generate-markdown.ts", - "docs:generate:api-pages": "ts-node scripts/generate-api-pages.ts", + "docs:generate:parsing": "npm run build:docs && npx tsx scripts/parse-docs.ts", + "docs:generate:markdown": "npx tsx ./scripts/generate-markdown.ts", + "docs:generate:api-pages": "npx tsx ./scripts/generate-api-pages.ts", "test:watch": "vitest --watch", "test": "vitest --run --coverage", "typecheck": "tsc --noEmit" @@ -85,6 +88,7 @@ "@microsoft/api-extractor": "7.39.0", "@microsoft/api-extractor-model": "7.28.3", "@microsoft/tsdoc": "0.14.2", + "@npmcli/package-json": "5.0.0", "@rushstack/node-core-library": "3.62.0", "@trpc/server": "10.44.1", "@types/aws-lambda": "8.10.130", @@ -102,6 +106,7 @@ "commitizen": "4.3.0", "cors": "2.8.5", "cz-conventional-changelog": "3.3.0", + "esbuild": "0.19.10", "eslint": "8.56.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-import": "2.29.1", @@ -119,6 +124,7 @@ "stream-mock": "2.0.5", "supertest": "6.3.3", "ts-node": "10.9.2", + "tsup": "8.0.1", "typedoc": "0.25.4", "typescript": "~5.3.3", "vite": "5.0.10", @@ -212,5 +218,287 @@ }, "publishConfig": { "access": "public" + }, + "exports": { + ".": { + "import": { + "types": "./lib/index.d.ts", + "default": "./lib/index.js" + }, + "require": { + "types": "./lib/index.d.cts", + "default": "./lib/index.cjs" + } + }, + "./adapters/apollo-server": { + "import": { + "types": "./lib/adapters/apollo-server/index.d.ts", + "default": "./lib/adapters/apollo-server/index.js" + }, + "require": { + "types": "./lib/adapters/apollo-server/index.d.cts", + "default": "./lib/adapters/apollo-server/index.cjs" + } + }, + "./adapters/aws": { + "import": { + "types": "./lib/adapters/aws/index.d.ts", + "default": "./lib/adapters/aws/index.js" + }, + "require": { + "types": "./lib/adapters/aws/index.d.cts", + "default": "./lib/adapters/aws/index.cjs" + } + }, + "./adapters/azure": { + "import": { + "types": "./lib/adapters/azure/index.d.ts", + "default": "./lib/adapters/azure/index.js" + }, + "require": { + "types": "./lib/adapters/azure/index.d.cts", + "default": "./lib/adapters/azure/index.cjs" + } + }, + "./adapters/digital-ocean": { + "import": { + "types": "./lib/adapters/digital-ocean/index.d.ts", + "default": "./lib/adapters/digital-ocean/index.js" + }, + "require": { + "types": "./lib/adapters/digital-ocean/index.d.cts", + "default": "./lib/adapters/digital-ocean/index.cjs" + } + }, + "./adapters/dummy": { + "import": { + "types": "./lib/adapters/dummy/index.d.ts", + "default": "./lib/adapters/dummy/index.js" + }, + "require": { + "types": "./lib/adapters/dummy/index.d.cts", + "default": "./lib/adapters/dummy/index.cjs" + } + }, + "./adapters/huawei": { + "import": { + "types": "./lib/adapters/huawei/index.d.ts", + "default": "./lib/adapters/huawei/index.js" + }, + "require": { + "types": "./lib/adapters/huawei/index.d.cts", + "default": "./lib/adapters/huawei/index.cjs" + } + }, + "./frameworks/apollo-server": { + "import": { + "types": "./lib/frameworks/apollo-server/index.d.ts", + "default": "./lib/frameworks/apollo-server/index.js" + }, + "require": { + "types": "./lib/frameworks/apollo-server/index.d.cts", + "default": "./lib/frameworks/apollo-server/index.cjs" + } + }, + "./frameworks/body-parser": { + "import": { + "types": "./lib/frameworks/body-parser/index.d.ts", + "default": "./lib/frameworks/body-parser/index.js" + }, + "require": { + "types": "./lib/frameworks/body-parser/index.d.cts", + "default": "./lib/frameworks/body-parser/index.cjs" + } + }, + "./frameworks/cors": { + "import": { + "types": "./lib/frameworks/cors/index.d.ts", + "default": "./lib/frameworks/cors/index.js" + }, + "require": { + "types": "./lib/frameworks/cors/index.d.cts", + "default": "./lib/frameworks/cors/index.cjs" + } + }, + "./frameworks/deepkit": { + "import": { + "types": "./lib/frameworks/deepkit/index.d.ts", + "default": "./lib/frameworks/deepkit/index.js" + }, + "require": { + "types": "./lib/frameworks/deepkit/index.d.cts", + "default": "./lib/frameworks/deepkit/index.cjs" + } + }, + "./frameworks/express": { + "import": { + "types": "./lib/frameworks/express/index.d.ts", + "default": "./lib/frameworks/express/index.js" + }, + "require": { + "types": "./lib/frameworks/express/index.d.cts", + "default": "./lib/frameworks/express/index.cjs" + } + }, + "./frameworks/fastify": { + "import": { + "types": "./lib/frameworks/fastify/index.d.ts", + "default": "./lib/frameworks/fastify/index.js" + }, + "require": { + "types": "./lib/frameworks/fastify/index.d.cts", + "default": "./lib/frameworks/fastify/index.cjs" + } + }, + "./frameworks/hapi": { + "import": { + "types": "./lib/frameworks/hapi/index.d.ts", + "default": "./lib/frameworks/hapi/index.js" + }, + "require": { + "types": "./lib/frameworks/hapi/index.d.cts", + "default": "./lib/frameworks/hapi/index.cjs" + } + }, + "./frameworks/koa": { + "import": { + "types": "./lib/frameworks/koa/index.d.ts", + "default": "./lib/frameworks/koa/index.js" + }, + "require": { + "types": "./lib/frameworks/koa/index.d.cts", + "default": "./lib/frameworks/koa/index.cjs" + } + }, + "./frameworks/lazy": { + "import": { + "types": "./lib/frameworks/lazy/index.d.ts", + "default": "./lib/frameworks/lazy/index.js" + }, + "require": { + "types": "./lib/frameworks/lazy/index.d.cts", + "default": "./lib/frameworks/lazy/index.cjs" + } + }, + "./frameworks/trpc": { + "import": { + "types": "./lib/frameworks/trpc/index.d.ts", + "default": "./lib/frameworks/trpc/index.js" + }, + "require": { + "types": "./lib/frameworks/trpc/index.d.cts", + "default": "./lib/frameworks/trpc/index.cjs" + } + }, + "./handlers/aws": { + "import": { + "types": "./lib/handlers/aws/index.d.ts", + "default": "./lib/handlers/aws/index.js" + }, + "require": { + "types": "./lib/handlers/aws/index.d.cts", + "default": "./lib/handlers/aws/index.cjs" + } + }, + "./handlers/azure": { + "import": { + "types": "./lib/handlers/azure/index.d.ts", + "default": "./lib/handlers/azure/index.js" + }, + "require": { + "types": "./lib/handlers/azure/index.d.cts", + "default": "./lib/handlers/azure/index.cjs" + } + }, + "./handlers/default": { + "import": { + "types": "./lib/handlers/default/index.d.ts", + "default": "./lib/handlers/default/index.js" + }, + "require": { + "types": "./lib/handlers/default/index.d.cts", + "default": "./lib/handlers/default/index.cjs" + } + }, + "./handlers/digital-ocean": { + "import": { + "types": "./lib/handlers/digital-ocean/index.d.ts", + "default": "./lib/handlers/digital-ocean/index.js" + }, + "require": { + "types": "./lib/handlers/digital-ocean/index.d.cts", + "default": "./lib/handlers/digital-ocean/index.cjs" + } + }, + "./handlers/firebase": { + "import": { + "types": "./lib/handlers/firebase/index.d.ts", + "default": "./lib/handlers/firebase/index.js" + }, + "require": { + "types": "./lib/handlers/firebase/index.d.cts", + "default": "./lib/handlers/firebase/index.cjs" + } + }, + "./handlers/gcp": { + "import": { + "types": "./lib/handlers/gcp/index.d.ts", + "default": "./lib/handlers/gcp/index.js" + }, + "require": { + "types": "./lib/handlers/gcp/index.d.cts", + "default": "./lib/handlers/gcp/index.cjs" + } + }, + "./handlers/huawei": { + "import": { + "types": "./lib/handlers/huawei/index.d.ts", + "default": "./lib/handlers/huawei/index.js" + }, + "require": { + "types": "./lib/handlers/huawei/index.d.cts", + "default": "./lib/handlers/huawei/index.cjs" + } + }, + "./resolvers/aws-context": { + "import": { + "types": "./lib/resolvers/aws-context/index.d.ts", + "default": "./lib/resolvers/aws-context/index.js" + }, + "require": { + "types": "./lib/resolvers/aws-context/index.d.cts", + "default": "./lib/resolvers/aws-context/index.cjs" + } + }, + "./resolvers/callback": { + "import": { + "types": "./lib/resolvers/callback/index.d.ts", + "default": "./lib/resolvers/callback/index.js" + }, + "require": { + "types": "./lib/resolvers/callback/index.d.cts", + "default": "./lib/resolvers/callback/index.cjs" + } + }, + "./resolvers/dummy": { + "import": { + "types": "./lib/resolvers/dummy/index.d.ts", + "default": "./lib/resolvers/dummy/index.js" + }, + "require": { + "types": "./lib/resolvers/dummy/index.d.cts", + "default": "./lib/resolvers/dummy/index.cjs" + } + }, + "./resolvers/promise": { + "import": { + "types": "./lib/resolvers/promise/index.d.ts", + "default": "./lib/resolvers/promise/index.js" + }, + "require": { + "types": "./lib/resolvers/promise/index.d.cts", + "default": "./lib/resolvers/promise/index.cjs" + } + } } } diff --git a/scripts/generate-api-pages.ts b/scripts/generate-api-pages.ts index c736ed47..e3527f80 100644 --- a/scripts/generate-api-pages.ts +++ b/scripts/generate-api-pages.ts @@ -16,6 +16,7 @@ type BreadcrumbItem = { }; function isPlainTextNode(block: DocNode): block is DocPlainText { + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison return block.kind === DocNodeKind.PlainText; } @@ -37,8 +38,11 @@ function getBreadcrumbsWithApiItem(apiModel: ApiModel): BreadcrumbItem[] { const breadcrumbContent = breadcrumb.content .getChildNodes() + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison .filter(block => block.kind === DocNodeKind.Paragraph) + // @ts-ignore .reduce((acc, block) => [...acc, ...block.getChildNodes()], []) + // @ts-ignore .filter(isPlainTextNode) .map((plainText: DocPlainText) => plainText.text) .join(''); @@ -77,14 +81,10 @@ function build(): void { const pages: Sidebar[] = []; - let level: number = 0; - for (const breadcrumbWithApiItem of breadcrumbsWithApiItems) { let lastPage: SidebarItem | undefined; for (const breadcrumb of breadcrumbWithApiItem.breadcrumbs) { - level++; - const newPage: SidebarItem = { type: 'category', label: breadcrumb, diff --git a/scripts/generate-markdown.ts b/scripts/generate-markdown.ts index a54e85f4..c16ab7de 100644 --- a/scripts/generate-markdown.ts +++ b/scripts/generate-markdown.ts @@ -22,7 +22,7 @@ function build(): void { const filename = join(outputFolder, 'Introduction.md'); const introductionMarkdownContent = readFileSync(filename); - const introductionContent = `---\ntitle: Introduction\nsidebar_position: -1\n---${introductionMarkdownContent}`; + const introductionContent = `---\ntitle: Introduction\nsidebar_position: -1\n---\n\n${introductionMarkdownContent}`; writeFileSync(filename, introductionContent); } diff --git a/scripts/libs/CustomMarkdownDocumenter.ts b/scripts/libs/CustomMarkdownDocumenter.ts index b22fe08d..56e206af 100644 --- a/scripts/libs/CustomMarkdownDocumenter.ts +++ b/scripts/libs/CustomMarkdownDocumenter.ts @@ -1,6 +1,6 @@ import * as path from 'path'; import { - IMarkdownDocumenterFeatureOnBeforeWritePageArgs, + type IMarkdownDocumenterFeatureOnBeforeWritePageArgs, MarkdownDocumenterAccessor, MarkdownDocumenterFeatureContext, } from '@microsoft/api-documenter/lib'; @@ -27,15 +27,13 @@ import { ApiOptionalMixin, ApiPackage, ApiParameterListMixin, - ApiPropertyItem, ApiReleaseTagMixin, ApiReturnTypeMixin, - ApiStaticMixin, ApiTypeAlias, Excerpt, ExcerptToken, ExcerptTokenKind, - IResolveDeclarationReferenceResult, + type IResolveDeclarationReferenceResult, ReleaseTag, } from '@microsoft/api-extractor-model'; import { @@ -1063,36 +1061,6 @@ export class CustomMarkdownDocumenter { return new DocTableCell({ configuration }, section.nodes); } - private _createModifiersCell(apiItem: ApiItem): DocTableCell { - const configuration: TSDocConfiguration = this._tsdocConfiguration; - - const section: DocSection = new DocSection({ configuration }); - - if (ApiStaticMixin.isBaseClassOf(apiItem)) { - if (apiItem.isStatic) { - section.appendNodeInParagraph( - new DocCodeSpan({ configuration, code: 'static' }), - ); - } - } - - return new DocTableCell({ configuration }, section.nodes); - } - - private _createPropertyTypeCell(apiItem: ApiItem): DocTableCell { - const configuration: TSDocConfiguration = this._tsdocConfiguration; - - const section: DocSection = new DocSection({ configuration }); - - if (apiItem instanceof ApiPropertyItem) { - section.appendNode( - this._createParagraphForTypeExcerpt(apiItem.propertyTypeExcerpt), - ); - } - - return new DocTableCell({ configuration }, section.nodes); - } - private _writeBreadcrumb(output: DocSection, apiItem: ApiItem): void { const breadcrumbDivider = [ new DocPlainText({ @@ -1150,6 +1118,7 @@ export class CustomMarkdownDocumenter { let firstNode: boolean = true; for (const node of docSection.nodes) { if (firstNode) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison if (node.kind === DocNodeKind.Paragraph) { output.appendNodesInParagraph(node.getChildNodes()); firstNode = false; @@ -1181,8 +1150,11 @@ export class CustomMarkdownDocumenter { if (breadcrumb) { const breadcrumbContent = breadcrumb.content .getChildNodes() + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison .filter(block => block.kind === DocNodeKind.Paragraph) + // @ts-ignore .reduce((acc, block) => [...acc, ...block.getChildNodes()], []) + // @ts-ignore .filter(block => block.kind === DocNodeKind.PlainText) .map((plainText: DocPlainText) => plainText.text) .join(''); diff --git a/scripts/libs/MarkdownEmitter.ts b/scripts/libs/MarkdownEmitter.ts index 3b45c6a3..8b8d491c 100644 --- a/scripts/libs/MarkdownEmitter.ts +++ b/scripts/libs/MarkdownEmitter.ts @@ -1,9 +1,9 @@ import { CustomMarkdownEmitter } from '@microsoft/api-documenter/lib/markdown/CustomMarkdownEmitter'; -import { IMarkdownEmitterContext } from '@microsoft/api-documenter/lib/markdown/MarkdownEmitter'; +import type { IMarkdownEmitterContext } from '@microsoft/api-documenter/lib/markdown/MarkdownEmitter'; import { IndentedWriter } from '@microsoft/api-documenter/lib/utils/IndentedWriter'; export class MarkdownEmitter extends CustomMarkdownEmitter { - protected writePlainText( + protected override writePlainText( text: string, context: IMarkdownEmitterContext, ): void { diff --git a/src/@types/digital-ocean/digital-ocean-http-event.ts b/src/@types/digital-ocean/digital-ocean-http-event.ts index 54f047f3..a0613768 100644 --- a/src/@types/digital-ocean/digital-ocean-http-event.ts +++ b/src/@types/digital-ocean/digital-ocean-http-event.ts @@ -1,6 +1,6 @@ //#region Imports -import { SingleValueHeaders } from '../headers'; +import type { SingleValueHeaders } from '../headers'; //#endregion diff --git a/src/@types/digital-ocean/digital-ocean-http-response.ts b/src/@types/digital-ocean/digital-ocean-http-response.ts index 17049fea..090fda4d 100644 --- a/src/@types/digital-ocean/digital-ocean-http-response.ts +++ b/src/@types/digital-ocean/digital-ocean-http-response.ts @@ -1,6 +1,6 @@ //#region Imports -import { SingleValueHeaders } from '../headers'; +import type { SingleValueHeaders } from '../headers'; //#endregion diff --git a/src/@types/digital-ocean/index.ts b/src/@types/digital-ocean/index.ts index 93362fd0..7d22aa3f 100644 --- a/src/@types/digital-ocean/index.ts +++ b/src/@types/digital-ocean/index.ts @@ -1 +1,2 @@ export * from './digital-ocean-http-event'; +export * from './digital-ocean-http-response'; diff --git a/src/@types/huawei/huawei-api-gateway-event.ts b/src/@types/huawei/huawei-api-gateway-event.ts index 808b6a78..fe69535b 100644 --- a/src/@types/huawei/huawei-api-gateway-event.ts +++ b/src/@types/huawei/huawei-api-gateway-event.ts @@ -1,6 +1,6 @@ //#region Imports -import { BothValueHeaders } from '../index'; +import type { BothValueHeaders } from '../index'; //#endregion diff --git a/src/@types/huawei/huawei-api-gateway-response.ts b/src/@types/huawei/huawei-api-gateway-response.ts index 28f3b2a2..8799fa33 100644 --- a/src/@types/huawei/huawei-api-gateway-response.ts +++ b/src/@types/huawei/huawei-api-gateway-response.ts @@ -1,6 +1,6 @@ //#region Imports -import { MultiValueHeaders } from '../headers'; +import type { MultiValueHeaders } from '../headers'; //#endregion diff --git a/src/adapters/apollo-server/apollo-server-mutation.adapter.ts b/src/adapters/apollo-server/apollo-server-mutation.adapter.ts index d4d5ad3e..ec316ccd 100644 --- a/src/adapters/apollo-server/apollo-server-mutation.adapter.ts +++ b/src/adapters/apollo-server/apollo-server-mutation.adapter.ts @@ -1,13 +1,13 @@ //#region Imports -import { +import type { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps, } from '../../contracts'; import { - ILogger, + type ILogger, getDefaultIfUndefined, getEventBodyAsBuffer, } from '../../core'; diff --git a/src/adapters/aws/alb.adapter.ts b/src/adapters/aws/alb.adapter.ts index 082548cc..4f0fe99a 100644 --- a/src/adapters/aws/alb.adapter.ts +++ b/src/adapters/aws/alb.adapter.ts @@ -1,14 +1,14 @@ //#region Imports import type { ALBEvent, ALBResult, Context } from 'aws-lambda'; -import { +import type { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps, } from '../../contracts'; import { - StripBasePathFn, + type StripBasePathFn, buildStripBasePath, getEventBodyAsBuffer, getFlattenedHeadersMap, diff --git a/src/adapters/aws/api-gateway-v1.adapter.ts b/src/adapters/aws/api-gateway-v1.adapter.ts index 373cc175..9eb6a9f3 100644 --- a/src/adapters/aws/api-gateway-v1.adapter.ts +++ b/src/adapters/aws/api-gateway-v1.adapter.ts @@ -2,14 +2,14 @@ import type { APIGatewayProxyResult, Context } from 'aws-lambda'; import type { APIGatewayProxyEvent } from 'aws-lambda/trigger/api-gateway-proxy'; -import { +import type { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps, } from '../../contracts'; import { - StripBasePathFn, + type StripBasePathFn, buildStripBasePath, getEventBodyAsBuffer, getMultiValueHeadersMap, diff --git a/src/adapters/aws/api-gateway-v2.adapter.ts b/src/adapters/aws/api-gateway-v2.adapter.ts index 770c4b9f..ba3923cc 100644 --- a/src/adapters/aws/api-gateway-v2.adapter.ts +++ b/src/adapters/aws/api-gateway-v2.adapter.ts @@ -2,14 +2,14 @@ import type { APIGatewayProxyEventV2, Context } from 'aws-lambda'; import type { APIGatewayProxyStructuredResultV2 } from 'aws-lambda/trigger/api-gateway-proxy'; -import { +import type { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps, } from '../../contracts'; import { - StripBasePathFn, + type StripBasePathFn, buildStripBasePath, getEventBodyAsBuffer, getFlattenedHeadersMapAndCookies, diff --git a/src/adapters/aws/base/aws-simple-adapter.ts b/src/adapters/aws/base/aws-simple-adapter.ts index 095e53f4..0cd21852 100644 --- a/src/adapters/aws/base/aws-simple-adapter.ts +++ b/src/adapters/aws/base/aws-simple-adapter.ts @@ -1,17 +1,17 @@ //#region Imports import type { Context, SQSBatchItemFailure } from 'aws-lambda'; -import { +import type { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps, -} from '../../../contracts/index'; +} from '../../../contracts'; import { EmptyResponse, - IEmptyResponse, + type IEmptyResponse, getEventBodyAsBuffer, -} from '../../../core/index'; +} from '../../../core'; //#endregion @@ -93,7 +93,7 @@ export abstract class AwsSimpleAdapter /** * {@inheritDoc} */ - public canHandle(event: unknown): event is TEvent { + public canHandle(_: unknown): _ is TEvent { throw new Error('not implemented.'); } diff --git a/src/adapters/aws/dynamodb.adapter.ts b/src/adapters/aws/dynamodb.adapter.ts index 3cae84b6..73288c4f 100644 --- a/src/adapters/aws/dynamodb.adapter.ts +++ b/src/adapters/aws/dynamodb.adapter.ts @@ -2,7 +2,7 @@ import type { DynamoDBStreamEvent } from 'aws-lambda'; import { getDefaultIfUndefined } from '../../core'; -import { AWSSimpleAdapterOptions, AwsSimpleAdapter } from './base/index'; +import { type AWSSimpleAdapterOptions, AwsSimpleAdapter } from './base/index'; //#endregion @@ -76,14 +76,14 @@ export class DynamoDBAdapter extends AwsSimpleAdapter { /** * {@inheritDoc} */ - public getAdapterName(): string { + public override getAdapterName(): string { return DynamoDBAdapter.name; } /** * {@inheritDoc} */ - public canHandle(event: unknown): event is DynamoDBStreamEvent { + public override canHandle(event: unknown): event is DynamoDBStreamEvent { const dynamoDBevent = event as Partial; if (!Array.isArray(dynamoDBevent?.Records)) return false; diff --git a/src/adapters/aws/event-bridge.adapter.ts b/src/adapters/aws/event-bridge.adapter.ts index b8a3d892..62962d9d 100644 --- a/src/adapters/aws/event-bridge.adapter.ts +++ b/src/adapters/aws/event-bridge.adapter.ts @@ -2,7 +2,7 @@ import type { EventBridgeEvent } from 'aws-lambda'; import { getDefaultIfUndefined } from '../../core'; -import { AwsSimpleAdapter } from './base/index'; +import { AwsSimpleAdapter } from './base'; //#endregion @@ -83,14 +83,14 @@ export class EventBridgeAdapter extends AwsSimpleAdapter { /** * {@inheritDoc} */ - public getAdapterName(): string { + public override getAdapterName(): string { return EventBridgeAdapter.name; } /** * {@inheritDoc} */ - public canHandle(event: unknown): event is EventBridgeEventAll { + public override canHandle(event: unknown): event is EventBridgeEventAll { const eventBridgeEvent = event as Partial; // thanks to @cnuss in https://github.com/vendia/serverless-express/blob/b5da6070b8dd2fb674c1f7035dd7edfef1dc83a2/src/event-sources/utils.js#L87 diff --git a/src/adapters/aws/lambda-edge.adapter.ts b/src/adapters/aws/lambda-edge.adapter.ts index df7e0660..95425f7a 100644 --- a/src/adapters/aws/lambda-edge.adapter.ts +++ b/src/adapters/aws/lambda-edge.adapter.ts @@ -10,8 +10,12 @@ import type { CloudFrontRequestEvent, CloudFrontRequestResult, } from 'aws-lambda/trigger/cloudfront-request'; -import { BothValueHeaders, Concrete, SingleValueHeaders } from '../../@types'; -import { +import type { + BothValueHeaders, + Concrete, + SingleValueHeaders, +} from '../../@types'; +import type { AdapterContract, AdapterRequest, GetResponseAdapterProps, diff --git a/src/adapters/aws/request-lambda-edge.adapter.ts b/src/adapters/aws/request-lambda-edge.adapter.ts index e2518cb6..38629986 100644 --- a/src/adapters/aws/request-lambda-edge.adapter.ts +++ b/src/adapters/aws/request-lambda-edge.adapter.ts @@ -9,15 +9,15 @@ import type { CloudFrontRequestEvent, CloudFrontRequestResult, } from 'aws-lambda/trigger/cloudfront-request'; -import { BothValueHeaders, SingleValueHeaders } from '../../@types'; -import { +import type { BothValueHeaders, SingleValueHeaders } from '../../@types'; +import type { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps, } from '../../contracts'; import { - StripBasePathFn, + type StripBasePathFn, buildStripBasePath, getDefaultIfUndefined, getEventBodyAsBuffer, diff --git a/src/adapters/aws/s3.adapter.ts b/src/adapters/aws/s3.adapter.ts index 0b1d0d45..0a1c9151 100644 --- a/src/adapters/aws/s3.adapter.ts +++ b/src/adapters/aws/s3.adapter.ts @@ -69,14 +69,14 @@ export class S3Adapter extends AwsSimpleAdapter { /** * {@inheritDoc} */ - public getAdapterName(): string { + public override getAdapterName(): string { return S3Adapter.name; } /** * {@inheritDoc} */ - public canHandle(event: unknown): event is S3Event { + public override canHandle(event: unknown): event is S3Event { const s3Event = event as Partial; if (!Array.isArray(s3Event?.Records)) return false; diff --git a/src/adapters/aws/sns.adapter.ts b/src/adapters/aws/sns.adapter.ts index 105f64c5..d4bedd6a 100644 --- a/src/adapters/aws/sns.adapter.ts +++ b/src/adapters/aws/sns.adapter.ts @@ -2,7 +2,7 @@ import type { SNSEvent } from 'aws-lambda'; import { getDefaultIfUndefined } from '../../core'; -import { AwsSimpleAdapter } from './base/index'; +import { AwsSimpleAdapter } from './base'; //#endregion @@ -69,14 +69,14 @@ export class SNSAdapter extends AwsSimpleAdapter { /** * {@inheritDoc} */ - public getAdapterName(): string { + public override getAdapterName(): string { return SNSAdapter.name; } /** * {@inheritDoc} */ - public canHandle(event: unknown): event is SNSEvent { + public override canHandle(event: unknown): event is SNSEvent { const snsEvent = event as Partial; if (!Array.isArray(snsEvent?.Records)) return false; diff --git a/src/adapters/aws/sqs.adapter.ts b/src/adapters/aws/sqs.adapter.ts index fc7fd90c..4b79d68a 100644 --- a/src/adapters/aws/sqs.adapter.ts +++ b/src/adapters/aws/sqs.adapter.ts @@ -2,7 +2,7 @@ import type { SQSEvent } from 'aws-lambda'; import { getDefaultIfUndefined } from '../../core'; -import { AWSSimpleAdapterOptions, AwsSimpleAdapter } from './base/index'; +import { type AWSSimpleAdapterOptions, AwsSimpleAdapter } from './base/index'; //#endregion @@ -70,14 +70,14 @@ export class SQSAdapter extends AwsSimpleAdapter { /** * {@inheritDoc} */ - public getAdapterName(): string { + public override getAdapterName(): string { return SQSAdapter.name; } /** * {@inheritDoc} */ - public canHandle(event: unknown): event is SQSEvent { + public override canHandle(event: unknown): event is SQSEvent { const sqsEvent = event as Partial; if (!Array.isArray(sqsEvent?.Records)) return false; diff --git a/src/adapters/azure/http-trigger-v4.adapter.ts b/src/adapters/azure/http-trigger-v4.adapter.ts index ded508be..c2a300e3 100644 --- a/src/adapters/azure/http-trigger-v4.adapter.ts +++ b/src/adapters/azure/http-trigger-v4.adapter.ts @@ -1,14 +1,14 @@ //#region Imports -import { URL } from 'url'; +import { URL } from 'node:url'; import type { Context, Cookie, HttpRequest, HttpResponseSimple, } from '@azure/functions'; -import { BothValueHeaders } from '../../@types'; -import { +import type { BothValueHeaders } from '../../@types'; +import type { AdapterContract, AdapterRequest, GetResponseAdapterProps, diff --git a/src/adapters/digital-ocean/http-function.adapter.ts b/src/adapters/digital-ocean/http-function.adapter.ts index 627cb9f2..48d72b61 100644 --- a/src/adapters/digital-ocean/http-function.adapter.ts +++ b/src/adapters/digital-ocean/http-function.adapter.ts @@ -1,8 +1,12 @@ //#region Imports -import { DigitalOceanHttpEvent } from '../../@types/digital-ocean'; -import { DigitalOceanHttpResponse } from '../../@types/digital-ocean/digital-ocean-http-response'; -import { +//#region Imports + +import type { + DigitalOceanHttpEvent, + DigitalOceanHttpResponse, +} from '../../@types/digital-ocean'; +import type { AdapterContract, AdapterRequest, GetResponseAdapterProps, diff --git a/src/adapters/dummy/dummy.adapter.ts b/src/adapters/dummy/dummy.adapter.ts index ece6e696..2d20a8aa 100644 --- a/src/adapters/dummy/dummy.adapter.ts +++ b/src/adapters/dummy/dummy.adapter.ts @@ -1,7 +1,11 @@ //#region Imports -import { AdapterContract, AdapterRequest, OnErrorProps } from '../../contracts'; -import { EmptyResponse, IEmptyResponse } from '../../core'; +import type { + AdapterContract, + AdapterRequest, + OnErrorProps, +} from '../../contracts'; +import { EmptyResponse, type IEmptyResponse } from '../../core'; //#endregion diff --git a/src/adapters/huawei/huawei-api-gateway.adapter.ts b/src/adapters/huawei/huawei-api-gateway.adapter.ts index 584f7b9a..8bf832e4 100644 --- a/src/adapters/huawei/huawei-api-gateway.adapter.ts +++ b/src/adapters/huawei/huawei-api-gateway.adapter.ts @@ -1,11 +1,11 @@ //#region Imports -import { +import type { HuaweiApiGatewayEvent, HuaweiApiGatewayResponse, HuaweiContext, } from '../../@types/huawei'; -import { +import type { AdapterContract, AdapterRequest, GetResponseAdapterProps, diff --git a/src/contracts/adapter.contract.ts b/src/contracts/adapter.contract.ts index 95bcd0a5..9d78b4ca 100644 --- a/src/contracts/adapter.contract.ts +++ b/src/contracts/adapter.contract.ts @@ -1,9 +1,9 @@ //#region Imports -import { BothValueHeaders, SingleValueHeaders } from '../@types'; -import { ILogger } from '../core'; +import type { BothValueHeaders, SingleValueHeaders } from '../@types'; +import type { ILogger } from '../core'; import { ServerlessResponse } from '../network'; -import { DelegatedResolver } from './resolver.contract'; +import type { DelegatedResolver } from './resolver.contract'; //#endregion diff --git a/src/contracts/framework.contract.ts b/src/contracts/framework.contract.ts index 0baf85e4..f3b9d15b 100644 --- a/src/contracts/framework.contract.ts +++ b/src/contracts/framework.contract.ts @@ -1,6 +1,6 @@ //#region Imports -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; //#endregion diff --git a/src/contracts/handler.contract.ts b/src/contracts/handler.contract.ts index b70085b3..b29dc7d9 100644 --- a/src/contracts/handler.contract.ts +++ b/src/contracts/handler.contract.ts @@ -1,10 +1,10 @@ //#region Imports -import { BinarySettings } from '../@types'; -import { ILogger } from '../core'; -import { AdapterContract } from './adapter.contract'; -import { FrameworkContract } from './framework.contract'; -import { ResolverContract } from './resolver.contract'; +import type { BinarySettings } from '../@types'; +import type { ILogger } from '../core'; +import type { AdapterContract } from './adapter.contract'; +import type { FrameworkContract } from './framework.contract'; +import type { ResolverContract } from './resolver.contract'; //#endregion diff --git a/src/contracts/resolver.contract.ts b/src/contracts/resolver.contract.ts index afe758db..252265ea 100644 --- a/src/contracts/resolver.contract.ts +++ b/src/contracts/resolver.contract.ts @@ -1,7 +1,7 @@ //#region Imports -import { ILogger } from '../core'; -import { AdapterContract } from './adapter.contract'; +import type { ILogger } from '../core'; +import type { AdapterContract } from './adapter.contract'; //#endregion diff --git a/src/core/base-handler.ts b/src/core/base-handler.ts index 4ff9a6c1..124f31db 100644 --- a/src/core/base-handler.ts +++ b/src/core/base-handler.ts @@ -1,7 +1,7 @@ //#region Imports -import { BinarySettings } from '../@types'; -import { +import type { BinarySettings } from '../@types'; +import type { AdapterContract, AdapterRequest, FrameworkContract, @@ -10,7 +10,7 @@ import { ServerlessHandler, } from '../contracts'; import { ServerlessRequest, ServerlessResponse } from '../network'; -import { ILogger } from './index'; +import type { ILogger } from './index'; //#endregion diff --git a/src/core/headers.ts b/src/core/headers.ts index e0196dad..1bb43bdc 100644 --- a/src/core/headers.ts +++ b/src/core/headers.ts @@ -1,6 +1,6 @@ //#region Imports -import { BothValueHeaders } from '../@types'; +import type { BothValueHeaders } from '../@types'; //#endregion diff --git a/src/core/is-binary.ts b/src/core/is-binary.ts index e9c03b33..1a1a47ac 100644 --- a/src/core/is-binary.ts +++ b/src/core/is-binary.ts @@ -2,7 +2,7 @@ //#region Imports -import { BinarySettings, BothValueHeaders } from '../@types'; +import type { BinarySettings, BothValueHeaders } from '../@types'; //#endregion diff --git a/src/core/logger.ts b/src/core/logger.ts index caa017c8..a5f3cebc 100644 --- a/src/core/logger.ts +++ b/src/core/logger.ts @@ -83,7 +83,7 @@ const logLevels: Record< none: [], }; -const lazyPrint = value => { +const lazyPrint = (value: () => any | unknown) => { if (typeof value === 'function') return value(); return value; @@ -91,7 +91,7 @@ const lazyPrint = value => { const print = (fn: string) => - (message, ...additional) => + (message: any, ...additional: (() => any)[]) => console[fn](message, ...additional.map(lazyPrint)); /** diff --git a/src/core/stream.ts b/src/core/stream.ts index 94950f86..2e49f48c 100644 --- a/src/core/stream.ts +++ b/src/core/stream.ts @@ -1,6 +1,6 @@ //#region Imports -import { Readable, Writable } from 'stream'; +import { Readable, Writable } from 'node:stream'; //#endregion @@ -39,7 +39,7 @@ export function waitForStreamComplete( // but I'll leave it at that because I didn't write that code, so I couldn't figure out what the author thought when he wrote this. let isComplete = false; - function complete(err) { + function complete(err: any) { /* istanbul ignore next */ if (isComplete) return; diff --git a/src/frameworks/apollo-server/apollo-server.framework.ts b/src/frameworks/apollo-server/apollo-server.framework.ts index 522c1dd5..432f8a16 100644 --- a/src/frameworks/apollo-server/apollo-server.framework.ts +++ b/src/frameworks/apollo-server/apollo-server.framework.ts @@ -1,8 +1,8 @@ //#region -import { IncomingMessage, ServerResponse } from 'http'; -import { ApolloServer, BaseContext, HeaderMap } from '@apollo/server'; -import { FrameworkContract } from '../../contracts'; +import type { IncomingMessage, ServerResponse } from 'http'; +import { type ApolloServer, type BaseContext, HeaderMap } from '@apollo/server'; +import type { FrameworkContract } from '../../contracts'; import { ServerlessRequest } from '../../network'; import { getDefaultIfUndefined } from '../../core'; diff --git a/src/frameworks/body-parser/base-body-parser.framework.ts b/src/frameworks/body-parser/base-body-parser.framework.ts index 7d5a37e8..f2a2b569 100644 --- a/src/frameworks/body-parser/base-body-parser.framework.ts +++ b/src/frameworks/body-parser/base-body-parser.framework.ts @@ -1,9 +1,9 @@ //#region Imports -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; import type { NextHandleFunction } from 'connect'; import type { HttpError } from 'http-errors'; -import { FrameworkContract } from '../../contracts'; +import type { FrameworkContract } from '../../contracts'; import { getDefaultIfUndefined } from '../../core'; //#endregion @@ -116,12 +116,12 @@ export class BaseBodyParserFramework implements FrameworkContract { /** * The default function to handle errors * - * @param request - The referecene for request + * @param _request - The referecene for request * @param response - The reference for response * @param error - The error throwed by body-parser */ protected defaultHandleOnError( - request: IncomingMessage, + _request: IncomingMessage, response: ServerResponse, error: HttpError, ): void { diff --git a/src/frameworks/body-parser/json-body-parser.framework.ts b/src/frameworks/body-parser/json-body-parser.framework.ts index b8bc73ef..c3ca8a74 100644 --- a/src/frameworks/body-parser/json-body-parser.framework.ts +++ b/src/frameworks/body-parser/json-body-parser.framework.ts @@ -1,10 +1,10 @@ //#region Imports -import { OptionsJson, json } from 'body-parser'; -import { FrameworkContract } from '../../contracts'; +import { type OptionsJson, json } from 'body-parser'; +import { type FrameworkContract } from '../../contracts'; import { BaseBodyParserFramework, - BodyParserOptions, + type BodyParserOptions, } from './base-body-parser.framework'; //#endregion @@ -35,7 +35,7 @@ export class JsonBodyParserFramework * Default Constructor */ constructor( - protected readonly framework: FrameworkContract, + framework: FrameworkContract, options?: JsonBodyParserFrameworkOptions, ) { super(framework, json(options), options); diff --git a/src/frameworks/body-parser/raw-body-parser.framework.ts b/src/frameworks/body-parser/raw-body-parser.framework.ts index c44dcd7f..a7fa6c20 100644 --- a/src/frameworks/body-parser/raw-body-parser.framework.ts +++ b/src/frameworks/body-parser/raw-body-parser.framework.ts @@ -1,10 +1,10 @@ //#region Imports -import { Options, raw } from 'body-parser'; -import { FrameworkContract } from '../../contracts'; +import { type Options, raw } from 'body-parser'; +import type { FrameworkContract } from '../../contracts'; import { BaseBodyParserFramework, - BodyParserOptions, + type BodyParserOptions, } from './base-body-parser.framework'; //#endregion @@ -35,7 +35,7 @@ export class RawBodyParserFramework * Default Constructor */ constructor( - protected readonly framework: FrameworkContract, + framework: FrameworkContract, options?: RawBodyParserFrameworkOptions, ) { super(framework, raw(options), options); diff --git a/src/frameworks/body-parser/text-body-parser.framework.ts b/src/frameworks/body-parser/text-body-parser.framework.ts index 8901e3b8..8f7a8dc9 100644 --- a/src/frameworks/body-parser/text-body-parser.framework.ts +++ b/src/frameworks/body-parser/text-body-parser.framework.ts @@ -1,10 +1,10 @@ //#region Imports -import { OptionsText, text } from 'body-parser'; -import { FrameworkContract } from '../../contracts'; +import { type OptionsText, text } from 'body-parser'; +import type { FrameworkContract } from '../../contracts'; import { BaseBodyParserFramework, - BodyParserOptions, + type BodyParserOptions, } from './base-body-parser.framework'; //#endregion @@ -35,7 +35,7 @@ export class TextBodyParserFramework * Default Constructor */ constructor( - protected readonly framework: FrameworkContract, + framework: FrameworkContract, options?: TextBodyParserFrameworkOptions, ) { super(framework, text(options), options); diff --git a/src/frameworks/body-parser/urlencoded-body-parser.framework.ts b/src/frameworks/body-parser/urlencoded-body-parser.framework.ts index f66fb77f..deb8fc75 100644 --- a/src/frameworks/body-parser/urlencoded-body-parser.framework.ts +++ b/src/frameworks/body-parser/urlencoded-body-parser.framework.ts @@ -1,10 +1,10 @@ //#region Imports -import { OptionsUrlencoded, urlencoded } from 'body-parser'; -import { FrameworkContract } from '../../contracts'; +import { type OptionsUrlencoded, urlencoded } from 'body-parser'; +import { type FrameworkContract } from '../../contracts'; import { BaseBodyParserFramework, - BodyParserOptions, + type BodyParserOptions, } from './base-body-parser.framework'; //#endregion @@ -36,7 +36,7 @@ export class UrlencodedBodyParserFramework * Default Constructor */ constructor( - protected readonly framework: FrameworkContract, + framework: FrameworkContract, options?: UrlencodedBodyParserFrameworkOptions, ) { super(framework, urlencoded(options), options); diff --git a/src/frameworks/cors/cors.framework.ts b/src/frameworks/cors/cors.framework.ts index 005b2ec6..19a60336 100644 --- a/src/frameworks/cors/cors.framework.ts +++ b/src/frameworks/cors/cors.framework.ts @@ -1,8 +1,8 @@ //#region Imports -import { IncomingMessage, ServerResponse } from 'http'; -import cors, { CorsOptions } from 'cors'; -import { FrameworkContract } from '../../contracts'; +import type { IncomingMessage, ServerResponse } from 'http'; +import cors, { type CorsOptions } from 'cors'; +import type { FrameworkContract } from '../../contracts'; import { getDefaultIfUndefined } from '../../core'; //#endregion diff --git a/src/frameworks/deepkit/http-deepkit.framework.ts b/src/frameworks/deepkit/http-deepkit.framework.ts index 2f3b7a87..48f7e2a1 100644 --- a/src/frameworks/deepkit/http-deepkit.framework.ts +++ b/src/frameworks/deepkit/http-deepkit.framework.ts @@ -1,8 +1,8 @@ //#region -import { ServerResponse } from 'http'; +import type { ServerResponse } from 'http'; import { HttpKernel, HttpResponse, RequestBuilder } from '@deepkit/http'; -import { FrameworkContract } from '../../contracts'; +import type { FrameworkContract } from '../../contracts'; import { getFlattenedHeadersMap } from '../../core'; import { ServerlessRequest } from '../../network'; diff --git a/src/frameworks/express/express.framework.ts b/src/frameworks/express/express.framework.ts index 561fd252..9912814a 100644 --- a/src/frameworks/express/express.framework.ts +++ b/src/frameworks/express/express.framework.ts @@ -1,8 +1,8 @@ //#region -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; import type { Express } from 'express'; -import { FrameworkContract } from '../../contracts'; +import type { FrameworkContract } from '../../contracts'; //#endregion diff --git a/src/frameworks/fastify/fastify.framework.ts b/src/frameworks/fastify/fastify.framework.ts index 0c83c7d9..9fa30f2c 100644 --- a/src/frameworks/fastify/fastify.framework.ts +++ b/src/frameworks/fastify/fastify.framework.ts @@ -1,8 +1,8 @@ //#region Imports -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; import type { FastifyInstance } from 'fastify'; -import { FrameworkContract } from '../../contracts'; +import type { FrameworkContract } from '../../contracts'; //#endregion diff --git a/src/frameworks/fastify/helpers/no-op-content-parser.ts b/src/frameworks/fastify/helpers/no-op-content-parser.ts index 67c871f5..791350e5 100644 --- a/src/frameworks/fastify/helpers/no-op-content-parser.ts +++ b/src/frameworks/fastify/helpers/no-op-content-parser.ts @@ -1,6 +1,6 @@ //#region Imports -import { FastifyInstance } from 'fastify'; +import type { FastifyInstance } from 'fastify'; //#endregion diff --git a/src/frameworks/hapi/hapi.framework.ts b/src/frameworks/hapi/hapi.framework.ts index 0fa05c24..db55f00a 100644 --- a/src/frameworks/hapi/hapi.framework.ts +++ b/src/frameworks/hapi/hapi.framework.ts @@ -1,8 +1,8 @@ //#region Imports -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; import type { Server } from '@hapi/hapi'; -import { FrameworkContract } from '../../contracts'; +import type { FrameworkContract } from '../../contracts'; //#endregion diff --git a/src/frameworks/koa/koa.framework.ts b/src/frameworks/koa/koa.framework.ts index 249c547c..c1aa6742 100644 --- a/src/frameworks/koa/koa.framework.ts +++ b/src/frameworks/koa/koa.framework.ts @@ -1,8 +1,8 @@ //#region Imports -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; import type Application from 'koa'; -import { FrameworkContract } from '../../contracts'; +import type { FrameworkContract } from '../../contracts'; //#endregion diff --git a/src/frameworks/lazy/lazy.framework.ts b/src/frameworks/lazy/lazy.framework.ts index ec4cbca2..07473c73 100644 --- a/src/frameworks/lazy/lazy.framework.ts +++ b/src/frameworks/lazy/lazy.framework.ts @@ -1,8 +1,8 @@ //#region Imports -import { IncomingMessage, ServerResponse } from 'http'; -import { FrameworkContract } from '../../contracts'; -import { ILogger, createDefaultLogger } from '../../core'; +import type { IncomingMessage, ServerResponse } from 'http'; +import type { FrameworkContract } from '../../contracts'; +import { type ILogger, createDefaultLogger } from '../../core'; //#endregion @@ -84,7 +84,7 @@ export class LazyFramework implements FrameworkContract { * {@inheritDoc} */ public sendRequest( - app: null, + _app: null, request: IncomingMessage, response: ServerResponse, ): void { diff --git a/src/frameworks/trpc/trpc.framework.ts b/src/frameworks/trpc/trpc.framework.ts index 5f423da7..85712da1 100644 --- a/src/frameworks/trpc/trpc.framework.ts +++ b/src/frameworks/trpc/trpc.framework.ts @@ -1,15 +1,15 @@ //#region -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; import type { AnyRouter, DataTransformer } from '@trpc/server'; import { - NodeHTTPCreateContextFn, - NodeHTTPCreateContextFnOptions, - NodeHTTPHandlerOptions, + type NodeHTTPCreateContextFn, + type NodeHTTPCreateContextFnOptions, + type NodeHTTPHandlerOptions, nodeHTTPRequestHandler, } from '@trpc/server/adapters/node-http'; -import { SingleValueHeaders } from '../../@types'; -import { FrameworkContract } from '../../contracts'; +import type { SingleValueHeaders } from '../../@types'; +import type { FrameworkContract } from '../../contracts'; import { getDefaultIfUndefined, getFlattenedHeadersMap } from '../../core'; //#endregion diff --git a/src/handlers/aws/aws-stream.handler.ts b/src/handlers/aws/aws-stream.handler.ts index 4af7ab74..ffe573bb 100644 --- a/src/handlers/aws/aws-stream.handler.ts +++ b/src/handlers/aws/aws-stream.handler.ts @@ -1,11 +1,11 @@ //#region Imports -import { Writable } from 'stream'; -import util from 'util'; +import { Writable } from 'node:stream'; +import { inspect } from 'node:util'; import type { APIGatewayProxyEventV2, Context } from 'aws-lambda'; import type { APIGatewayProxyStructuredResultV2 } from 'aws-lambda/trigger/api-gateway-proxy'; -import { BinarySettings } from '../../@types'; -import { +import type { BinarySettings } from '../../@types'; +import type { AdapterContract, AdapterRequest, FrameworkContract, @@ -14,7 +14,7 @@ import { } from '../../contracts'; import { BaseHandler, - ILogger, + type ILogger, getFlattenedHeadersMap, setCurrentInvoke, waitForStreamComplete, @@ -102,7 +102,7 @@ export class AwsStreamHandler extends BaseHandler< AWSStreamContext, AWSStreamResponseMetadata >[], - resolverFactory: ResolverContract< + _resolverFactory: ResolverContract< unknown, unknown, unknown, @@ -169,7 +169,7 @@ export class AwsStreamHandler extends BaseHandler< ): void { log.debug('SERVERLESS_ADAPTER:PROXY', () => ({ event, - context: util.inspect(context, { depth: null }), + context: inspect(context, { depth: null }), binarySettings, respondWithErrors, })); @@ -243,8 +243,8 @@ export class AwsStreamHandler extends BaseHandler< * @param event - The event sent by serverless * @param context - The context sent by serverless * @param adapter - The adapter resolved to this event + * @param _binarySettings - The binary settings * @param log - The instance of logger - * @param binarySettings - The binary settings */ protected async forwardRequestToFramework( app: TApp, @@ -256,7 +256,7 @@ export class AwsStreamHandler extends BaseHandler< AWSStreamContext, AWSStreamResponseMetadata >, - binarySettings: BinarySettings, + _binarySettings: BinarySettings, log: ILogger, ): Promise { const requestValues = adapter.getRequest(event, context, log); diff --git a/src/handlers/azure/azure.handler.ts b/src/handlers/azure/azure.handler.ts index 1e4bb74c..e8e6f45e 100644 --- a/src/handlers/azure/azure.handler.ts +++ b/src/handlers/azure/azure.handler.ts @@ -2,14 +2,18 @@ //#region Imports import type { Context } from '@azure/functions'; -import { BinarySettings } from '../../@types'; -import { +import type { BinarySettings } from '../../@types'; +import type { AdapterContract, FrameworkContract, ResolverContract, ServerlessHandler, } from '../../contracts'; -import { ILogger, getDefaultIfUndefined, isInternalLogger } from '../../core'; +import { + type ILogger, + getDefaultIfUndefined, + isInternalLogger, +} from '../../core'; import { DefaultHandler } from '../default'; //#endregion @@ -60,7 +64,7 @@ export class AzureHandler< /** * {@inheritDoc} */ - public getHandler( + public override getHandler( app: TApp, framework: FrameworkContract, adapters: AdapterContract[], diff --git a/src/handlers/base/raw-request.ts b/src/handlers/base/raw-request.ts index 5e9f892e..f6ea54e2 100644 --- a/src/handlers/base/raw-request.ts +++ b/src/handlers/base/raw-request.ts @@ -1,9 +1,9 @@ //#region Imports -import { IncomingMessage, ServerResponse } from 'http'; -import { FrameworkContract } from '../../contracts/index'; -import { ServerlessRequest } from '../../network/index'; -import { getEventBodyAsBuffer, getFlattenedHeadersMap } from '../../core/index'; +import type { IncomingMessage, ServerResponse } from 'http'; +import type { FrameworkContract } from '../../contracts'; +import { ServerlessRequest } from '../../network'; +import { getEventBodyAsBuffer, getFlattenedHeadersMap } from '../../core'; //#endregion diff --git a/src/handlers/default/default.handler.ts b/src/handlers/default/default.handler.ts index 410dfcfa..9e8c7d7a 100644 --- a/src/handlers/default/default.handler.ts +++ b/src/handlers/default/default.handler.ts @@ -1,8 +1,8 @@ //#region Imports -import util from 'util'; -import { BinarySettings, SingleValueHeaders } from '../../@types'; -import { +import util from 'node:util'; +import type { BinarySettings, SingleValueHeaders } from '../../@types'; +import type { AdapterContract, AdapterRequest, FrameworkContract, @@ -11,7 +11,7 @@ import { } from '../../contracts'; import { BaseHandler, - ILogger, + type ILogger, isBinary, setCurrentInvoke, waitForStreamComplete, diff --git a/src/handlers/digital-ocean/digital-ocean.handler.ts b/src/handlers/digital-ocean/digital-ocean.handler.ts index 377d2d40..d67ecef8 100644 --- a/src/handlers/digital-ocean/digital-ocean.handler.ts +++ b/src/handlers/digital-ocean/digital-ocean.handler.ts @@ -1,15 +1,15 @@ /* eslint-disable @typescript-eslint/unbound-method */ //#region Imports -import { BinarySettings } from '../../@types'; -import { DigitalOceanHttpEvent } from '../../@types/digital-ocean'; -import { +import type { BinarySettings } from '../../@types'; +import type { DigitalOceanHttpEvent } from '../../@types/digital-ocean'; +import type { AdapterContract, FrameworkContract, ResolverContract, ServerlessHandler, } from '../../contracts'; -import { ILogger } from '../../core'; +import type { ILogger } from '../../core'; import { DefaultHandler } from '../default'; //#endregion @@ -29,7 +29,7 @@ export class DigitalOceanHandler< /** * {@inheritDoc} */ - public getHandler( + public override getHandler( app: TApp, framework: FrameworkContract, adapters: AdapterContract[], diff --git a/src/handlers/firebase/http-firebase-v2.handler.ts b/src/handlers/firebase/http-firebase-v2.handler.ts index 5c16da65..589ce9ea 100644 --- a/src/handlers/firebase/http-firebase-v2.handler.ts +++ b/src/handlers/firebase/http-firebase-v2.handler.ts @@ -1,12 +1,24 @@ //#region Imports +import { IncomingMessage, ServerResponse } from 'node:http'; // eslint-disable-next-line import/no-unresolved import { https } from 'firebase-functions/v2'; -import { FrameworkContract, HandlerContract } from '../../contracts'; +import type { FrameworkContract, HandlerContract } from '../../contracts'; import { RawRequest } from '../base'; //#endregion +/** + * The HTTP handler that is exposed when you use {@link HttpFirebaseV2Handler}. + * + * @breadcrumb Handlers / HttpFirebaseHandler + * @public + */ +export type FirebaseHttpHandler = ( + request: IncomingMessage, + response: ServerResponse, +) => void | Promise; + /** * The class that implements a handler for Firebase Https Events * @@ -39,7 +51,7 @@ export class HttpFirebaseV2Handler public getHandler( app: TApp, framework: FrameworkContract, - ): ReturnType['onRequestCallback']> { + ): FirebaseHttpHandler { if (this.options) { return this.onRequestWithOptions( this.options, @@ -47,7 +59,9 @@ export class HttpFirebaseV2Handler ); } - return https.onRequest(this.onRequestCallback(app, framework)); + return https.onRequest( + this.onRequestCallback(app, framework), + ) as unknown as FirebaseHttpHandler; } //#endregion @@ -60,8 +74,8 @@ export class HttpFirebaseV2Handler protected onRequestWithOptions( options: https.HttpsOptions, callback: ReturnType['onRequestCallback']>, - ): ReturnType['onRequestCallback']> { - return https.onRequest(options, callback); + ): FirebaseHttpHandler { + return https.onRequest(options, callback) as unknown as FirebaseHttpHandler; } //#endregion diff --git a/src/handlers/firebase/http-firebase.handler.ts b/src/handlers/firebase/http-firebase.handler.ts index 96775a53..62c50d4b 100644 --- a/src/handlers/firebase/http-firebase.handler.ts +++ b/src/handlers/firebase/http-firebase.handler.ts @@ -1,9 +1,8 @@ //#region Imports -import { IncomingMessage, ServerResponse } from 'http'; // eslint-disable-next-line import/no-unresolved -import { https } from 'firebase-functions/v1'; -import { FrameworkContract, HandlerContract } from '../../contracts'; +import { type HttpsFunction, https } from 'firebase-functions/v1'; +import type { FrameworkContract, HandlerContract } from '../../contracts'; import { RawRequest } from '../base'; //#endregion @@ -28,7 +27,7 @@ export class HttpFirebaseHandler public getHandler( app: TApp, framework: FrameworkContract, - ): (req: IncomingMessage, res: ServerResponse) => void | Promise { + ): HttpsFunction { return https.onRequest(this.onRequestCallback(app, framework)); } diff --git a/src/handlers/gcp/gcp.handler.ts b/src/handlers/gcp/gcp.handler.ts index d81d1baa..38a47040 100644 --- a/src/handlers/gcp/gcp.handler.ts +++ b/src/handlers/gcp/gcp.handler.ts @@ -1,8 +1,8 @@ //#region Imports -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; import { http } from '@google-cloud/functions-framework'; -import { FrameworkContract, HandlerContract } from '../../contracts'; +import type { FrameworkContract, HandlerContract } from '../../contracts'; import { RawRequest } from '../base'; //#endregion diff --git a/src/handlers/huawei/http-huawei.handler.ts b/src/handlers/huawei/http-huawei.handler.ts index 92b580d6..1713225b 100644 --- a/src/handlers/huawei/http-huawei.handler.ts +++ b/src/handlers/huawei/http-huawei.handler.ts @@ -1,16 +1,16 @@ //#region Imports -import * as http from 'http'; -import { RequestListener } from 'http'; -import { BinarySettings } from '../../@types'; -import { +import type { RequestListener } from 'http'; +import { type Server, createServer } from 'node:http'; +import type { BinarySettings } from '../../@types'; +import type { AdapterContract, FrameworkContract, HandlerContract, ResolverContract, ServerlessHandler, } from '../../contracts'; -import { ILogger, getDefaultIfUndefined } from '../../core'; +import { type ILogger, getDefaultIfUndefined } from '../../core'; //#endregion @@ -39,7 +39,7 @@ export type HttpHuaweiHandlerOptions = { /** * The factory to create a http server to use to listen huawei requests */ - httpServerFactory?: (requestListener: RequestListener) => http.Server; + httpServerFactory?: (requestListener: RequestListener) => Server; }; /** @@ -72,10 +72,10 @@ export class HttpHuaweiHandler public getHandler( app: TApp, framework: FrameworkContract, - _: AdapterContract[], - __: ResolverContract, - binarySettings: BinarySettings, - respondWithErrors: boolean, + _adapters: AdapterContract[], + _resolver: ResolverContract, + _binarySettings: BinarySettings, + _respondWithErrors: boolean, log: ILogger, ): ServerlessHandler> { const requestListener: RequestListener = (req, res) => { @@ -117,8 +117,8 @@ export class HttpHuaweiHandler * * @param requestListener - O método que lidará com as requisições recebidas */ - protected createHttpServer(requestListener: RequestListener): http.Server { - return http.createServer(requestListener); + protected createHttpServer(requestListener: RequestListener): Server { + return createServer(requestListener); } //#endregion diff --git a/src/network/request.ts b/src/network/request.ts index f166b6bf..b437c9ab 100644 --- a/src/network/request.ts +++ b/src/network/request.ts @@ -1,7 +1,7 @@ // ATTRIBUTION: https://github.com/dougmoscrop/serverless-http -import { IncomingMessage } from 'http'; -import { AddressInfo } from 'net'; -import { SingleValueHeaders } from '../@types'; +import { IncomingMessage } from 'node:http'; +import type { AddressInfo } from 'node:net'; +import type { SingleValueHeaders } from '../@types'; import { NO_OP } from '../core'; const HTTPS_PORT = 443; diff --git a/src/network/response-stream.ts b/src/network/response-stream.ts index b24b05f8..a966ffe7 100644 --- a/src/network/response-stream.ts +++ b/src/network/response-stream.ts @@ -1,8 +1,8 @@ -import { ServerResponse } from 'http'; -import { Socket } from 'net'; -import { Writable } from 'stream'; -import { BothValueHeaders } from '../@types'; -import { ILogger, NO_OP, parseHeaders } from '../core'; +import { ServerResponse } from 'node:http'; +import type { Socket } from 'node:net'; +import type { Writable } from 'node:stream'; +import type { BothValueHeaders } from '../@types'; +import { type ILogger, NO_OP, parseHeaders } from '../core'; import { getString } from './utils'; const endChunked = '0\r\n\r\n'; diff --git a/src/network/response.ts b/src/network/response.ts index 02f005c2..2cf0e883 100644 --- a/src/network/response.ts +++ b/src/network/response.ts @@ -1,6 +1,6 @@ // ATTRIBUTION: https://github.com/dougmoscrop/serverless-http -import { IncomingMessage, ServerResponse } from 'http'; -import { Socket } from 'net'; +import { IncomingMessage, ServerResponse } from 'node:http'; +import type { Socket } from 'node:net'; import { NO_OP } from '../core'; import { getString } from './utils'; @@ -121,12 +121,15 @@ export class ServerlessResponse extends ServerResponse { return Object.assign(headers, res[HEADERS]); } - setHeader(key: string, value: number | string | readonly string[]): any { + override setHeader( + key: string, + value: number | string | readonly string[], + ): any { if (this._wroteHeader) this[HEADERS][key] = value; else super.setHeader(key, value); } - writeHead( + override writeHead( statusCode: number, statusMessage?: string | any | any[], obj?: any | any[], diff --git a/src/resolvers/aws-context/aws-context.resolver.ts b/src/resolvers/aws-context/aws-context.resolver.ts index 18ed65b8..b90a4e49 100644 --- a/src/resolvers/aws-context/aws-context.resolver.ts +++ b/src/resolvers/aws-context/aws-context.resolver.ts @@ -1,7 +1,7 @@ //#region Imports import type { Context } from 'aws-lambda'; -import { +import type { DelegatedResolver, Resolver, ResolverContract, diff --git a/src/resolvers/callback/callback.resolver.ts b/src/resolvers/callback/callback.resolver.ts index 1d79b523..b2b80991 100644 --- a/src/resolvers/callback/callback.resolver.ts +++ b/src/resolvers/callback/callback.resolver.ts @@ -1,6 +1,6 @@ //#region Imports -import { +import type { DelegatedResolver, Resolver, ResolverContract, diff --git a/src/resolvers/dummy/dummy.resolver.ts b/src/resolvers/dummy/dummy.resolver.ts index 20b69a5a..042022f5 100644 --- a/src/resolvers/dummy/dummy.resolver.ts +++ b/src/resolvers/dummy/dummy.resolver.ts @@ -1,6 +1,6 @@ //#region Imports -import { Resolver, ResolverContract } from '../../contracts'; +import type { Resolver, ResolverContract } from '../../contracts'; //#endregion diff --git a/src/resolvers/promise/promise.resolver.ts b/src/resolvers/promise/promise.resolver.ts index 7f7b754b..09c584f6 100644 --- a/src/resolvers/promise/promise.resolver.ts +++ b/src/resolvers/promise/promise.resolver.ts @@ -1,6 +1,6 @@ //#region Imports -import { +import type { DelegatedResolver, Resolver, ResolverContract, diff --git a/src/serverless-adapter.ts b/src/serverless-adapter.ts index ff71ae17..143bdecb 100644 --- a/src/serverless-adapter.ts +++ b/src/serverless-adapter.ts @@ -1,7 +1,7 @@ //#region Imports -import { BinarySettings } from './@types'; -import { +import type { BinarySettings } from './@types'; +import type { AdapterContract, FrameworkContract, HandlerContract, @@ -11,7 +11,7 @@ import { import { DEFAULT_BINARY_CONTENT_TYPES, DEFAULT_BINARY_ENCODINGS, - ILogger, + type ILogger, createDefaultLogger, } from './core'; diff --git a/test/core/utils/stream.ts b/test/core/utils/stream.ts index c52b7cfa..9abbbfe5 100644 --- a/test/core/utils/stream.ts +++ b/test/core/utils/stream.ts @@ -1,6 +1,6 @@ // credits to: https://github.com/b4nst/stream-mock/pull/64/files#diff-52aee274967f2fcfa3ffa78ebba2f510dd23d176aa92ccf8c0ad4843373f5ce7 -import { Readable, ReadableOptions } from 'stream'; +import { Readable, ReadableOptions } from 'node:stream'; import { IReadableMock } from 'stream-mock'; /** diff --git a/test/frameworks/apollo-server.framework.spec.ts b/test/frameworks/apollo-server.framework.spec.ts index 94d07919..6d2f0468 100644 --- a/test/frameworks/apollo-server.framework.spec.ts +++ b/test/frameworks/apollo-server.framework.spec.ts @@ -1,5 +1,5 @@ -import { OutgoingHttpHeaders } from 'http2'; -import { ApolloServer, BaseContext, HeaderMap } from '@apollo/server'; +import type { OutgoingHttpHeaders } from 'http'; +import { ApolloServer, type BaseContext, HeaderMap } from '@apollo/server'; import { describe, expect, it, vitest } from 'vitest'; import { ServerlessRequest, diff --git a/test/frameworks/body-parser.framework.spec.ts b/test/frameworks/body-parser.framework.spec.ts index fde124da..69f31b9b 100644 --- a/test/frameworks/body-parser.framework.spec.ts +++ b/test/frameworks/body-parser.framework.spec.ts @@ -1,7 +1,7 @@ -import { ServerResponse } from 'http'; +import type { ServerResponse } from 'http'; import * as trpc from '@trpc/server'; -import { Options } from 'body-parser'; -import express, { Express } from 'express'; +import type { Options } from 'body-parser'; +import express, { type Express } from 'express'; import fastify from 'fastify'; import Application from 'koa'; import { SpyInstance, describe, expect, it, vitest } from 'vitest'; diff --git a/test/handlers/gcp.handler.spec.ts b/test/handlers/gcp.handler.spec.ts index a76d4734..409998e2 100644 --- a/test/handlers/gcp.handler.spec.ts +++ b/test/handlers/gcp.handler.spec.ts @@ -1,4 +1,4 @@ -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; import { describe, expect, it, vitest } from 'vitest'; import { FrameworkContract } from '../../src'; import { GCPHandler } from '../../src/handlers/gcp'; diff --git a/test/handlers/http-firebase-v2.handler.spec.ts b/test/handlers/http-firebase-v2.handler.spec.ts index ddad19bc..545fef97 100644 --- a/test/handlers/http-firebase-v2.handler.spec.ts +++ b/test/handlers/http-firebase-v2.handler.spec.ts @@ -1,7 +1,7 @@ -import { HttpsOptions } from 'firebase-functions/lib/v2/providers/https'; +import type { HttpsOptions } from 'firebase-functions/v2/https'; import { describe, expect, it, vitest } from 'vitest'; import { - FrameworkContract, + type FrameworkContract, ServerlessRequest, ServerlessResponse, waitForStreamComplete, @@ -73,7 +73,7 @@ describe(HttpFirebaseV2Handler.name, () => { // eslint-disable-next-line @typescript-eslint/no-misused-promises sendRequest: vitest.fn( async ( - app: null, + _app: null, req: ServerlessRequest, res: ServerlessResponse, ) => { diff --git a/test/handlers/huawei.handler.spec.ts b/test/handlers/huawei.handler.spec.ts index 936c79bf..02212983 100644 --- a/test/handlers/huawei.handler.spec.ts +++ b/test/handlers/huawei.handler.spec.ts @@ -1,4 +1,4 @@ -import * as http from 'http'; +import { type Server, createServer } from 'node:http'; import supertest from 'supertest'; import { describe, expect, it, vitest } from 'vitest'; import { ILogger } from '../../src'; @@ -36,7 +36,7 @@ describe('HttpHuaweiHandler', () => { listen: listenMock, close: closeMock, addEventListener: addEventListenerMock, - }) as unknown as http.Server, + }) as unknown as Server, ); const handlerFactory = new HttpHuaweiHandler({ @@ -101,12 +101,12 @@ describe('HttpHuaweiHandler', () => { }); it('should forward correctly the request to framework', async () => { - let httpServer!: http.Server; + let httpServer!: Server; const handlerFactory = new HttpHuaweiHandler({ port: 0, httpServerFactory: requestListener => { - const server = http.createServer(requestListener); + const server = createServer(requestListener); httpServer = server; @@ -141,7 +141,7 @@ describe('HttpHuaweiHandler', () => { const mockServer = { listen: vitest.fn(), close: vitest.fn(cb => cb(error)), - } as unknown as http.Server; + } as unknown as Server; const handlerFactory = new HttpHuaweiHandler({ httpServerFactory: () => { diff --git a/test/mocks/framework.mock.ts b/test/mocks/framework.mock.ts index dd312923..1d7c3ae3 100644 --- a/test/mocks/framework.mock.ts +++ b/test/mocks/framework.mock.ts @@ -1,6 +1,6 @@ //#region Imports -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; import { ObjectReadableMock } from 'stream-mock'; import { FrameworkContract } from '../../src'; diff --git a/tsconfig.doc.json b/tsconfig.doc.json index cb013a9b..19038e05 100644 --- a/tsconfig.doc.json +++ b/tsconfig.doc.json @@ -1,5 +1,11 @@ { "extends": "./tsconfig.json", + "compilerOptions": { + "emitDeclarationOnly": true, + "noEmit": false, + "skipDefaultLibCheck": true, + "skipLibCheck": true + }, "include": ["src/**/*.ts", "src/index.doc.ts"], "exclude": [] } diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 682c9711..88c9e51b 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -1,5 +1,24 @@ { "extends": "./tsconfig.json", - "include": ["src/**/*.ts", "test/**/*.ts", "scripts/**/*.ts", "src/index.doc.ts"], - "exclude": ["benchmark/**/*.ts", "vite.config.ts"] + "compilerOptions": { + "noEmit": true, + "types": [ + "vitest/globals" + ], + "lib": [ + "esnext" + ], + "allowJs": true, + "checkJs": true + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts", + "scripts/**/*.ts", + "vite.config.ts", + "tsup.config.ts" + ], + "exclude": [ + "benchmark/**/*.ts" + ] } diff --git a/tsconfig.json b/tsconfig.json index aae5877f..1cee8eff 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,77 +1,46 @@ { "$schema": "http://json.schemastore.org/tsconfig", "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Basic Options */ - // "incremental": true, /* Enable incremental compilation */ - "target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, - "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, - // "lib": [], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - "declaration": true /* Generates corresponding '.d.ts' file. */, - "declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */, - "sourceMap": true /* Generates corresponding '.map' file. */, - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./lib/" /* Redirect output structure to the directory. */, - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - "resolveJsonModule": true /* Enable importing .json files */, - - /* Strict Type-Checking Options */ - "strict": false /* Enable all strict type-checking options. */, - "noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */, - "strictNullChecks": true /* Enable strict null checks. */, - "strictFunctionTypes": false /* Enable strict checking of function types. */, - "strictBindCallApply": true /* Enable strict 'bind', 'call', and 'apply' methods on functions. */, - "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, - "noImplicitThis": false /* Raise error on 'this' expressions with an implied 'any' type. */, - "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ - "skipLibCheck": true /* Skip type checking of declaration files. */, - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */, - "useDefineForClassFields": false + "outDir": "./lib", + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "Bundler", + "incremental": false, + "noEmit": true, + "noImplicitAny": false, + "verbatimModuleSyntax": true, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "exactOptionalPropertyTypes": false, + "noImplicitOverride": true, + "allowSyntheticDefaultImports": true, + "alwaysStrict": true, + "declaration": true, + "declarationMap": true, + "esModuleInterop": true, + "importHelpers": false, + "newLine": "lf", + "noEmitHelpers": false, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "preserveConstEnums": true, + "pretty": true, + "removeComments": false, + "resolveJsonModule": true, + "sourceMap": true, + "strict": true, + "useDefineForClassFields": true }, "reflection": true, - "include": ["src/**/*.ts", "test/**/*.ts", "scripts/**/*.ts"], - "exclude": ["src/index.doc.ts", "benchmark/**/*.ts"] + "include": [ + "src/**/*.ts", + "test/**/*.ts", + "scripts/**/*.ts" + ], + "exclude": [ + "src/index.doc.ts", + "benchmark/**/*.ts" + ] } diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 00000000..337bf27a --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,88 @@ +import { execSync } from 'node:child_process'; +import { defineConfig } from 'tsup'; + +const adapters = [ + 'apollo-server', + 'aws', + 'azure', + 'digital-ocean', + 'dummy', + 'huawei', +]; + +const frameworks = [ + 'apollo-server', + 'body-parser', + 'cors', + 'deepkit', + 'express', + 'fastify', + 'hapi', + 'koa', + 'lazy', + 'trpc', +]; + +const handlers = [ + 'aws', + 'azure', + 'default', + 'digital-ocean', + 'firebase', + 'gcp', + 'huawei', +]; + +const resolvers = ['aws-context', 'callback', 'dummy', 'promise']; + +const libEntries = [ + ...adapters.map(adapter => `src/adapters/${adapter}/index.ts`), + ...frameworks.map(framework => `src/frameworks/${framework}/index.ts`), + ...handlers.map(handler => `src/handlers/${handler}/index.ts`), + ...resolvers.map(resolver => `src/resolvers/${resolver}/index.ts`), +]; + +const createExport = (filePath: string) => ({ + import: { + types: `./lib/${filePath}.d.ts`, + default: `./lib/${filePath}.js`, + }, + require: { + types: `./lib/${filePath}.d.cts`, + default: `./lib/${filePath}.cjs`, + }, +}); + +const createExportReducer = + (initialPath: string) => (acc: object, name: string) => { + acc[`./${initialPath}/${name}`] = createExport( + `${initialPath}/${name}/index`, + ); + + return acc; + }; + +const packageExports = { + '.': createExport('index'), + ...adapters.reduce(createExportReducer('adapters'), {}), + ...frameworks.reduce(createExportReducer('frameworks'), {}), + ...handlers.reduce(createExportReducer('handlers'), {}), + ...resolvers.reduce(createExportReducer('resolvers'), {}), +}; + +execSync(`npm pkg set exports='${JSON.stringify(packageExports)}' --json`); + +export default defineConfig({ + outDir: './lib', + clean: true, + dts: true, + format: ['esm', 'cjs'], + entry: ['src/index.ts', ...libEntries], + sourcemap: true, + skipNodeModulesBundle: true, + minify: true, + target: 'es2022', + tsconfig: './tsconfig.build.json', + keepNames: true, + bundle: true, +}); diff --git a/vite.config.ts b/vite.config.ts index b1f15031..87cda74e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,44 +1,13 @@ -import { glob } from 'glob'; -import * as path from 'path'; +// eslint-disable-next-line import/no-unresolved import { defineConfig } from 'vitest/config'; -const isTest = process.env.NODE_ENV === 'test'; - export default defineConfig({ - ...(!isTest && { - esbuild: { - format: 'cjs', - platform: 'node', - target: 'node18', - sourcemap: 'external', - minifyIdentifiers: false, - }, - build: { - outDir: 'lib', - emptyOutDir: true, - sourcemap: true, - lib: { - entry: path.resolve(__dirname, 'src/index.ts'), - formats: ['cjs'], - }, - rollupOptions: { - external: ['yeoman-generator'], - input: glob.sync(path.resolve(__dirname, 'src/**/*.ts')), - output: { - preserveModules: true, - entryFileNames: entry => { - const { name } = entry; - - const fileName = `${name}.js`; - - return fileName; - }, - }, - }, - }, - }), + esbuild: { + target: 'es2022', + }, test: { coverage: { + provider: 'v8', include: ['src/**'], exclude: [ 'src/**/@types/**/*.ts', diff --git a/www/docs/main/frameworks/helpers/body-parser.mdx b/www/docs/main/frameworks/helpers/body-parser.mdx index 1853a7e2..ca555f7d 100644 --- a/www/docs/main/frameworks/helpers/body-parser.mdx +++ b/www/docs/main/frameworks/helpers/body-parser.mdx @@ -101,7 +101,7 @@ Is your application instance creation asynchronous? Look the [LazyFramework](./l If you want to customize the error messages, like when the size limit is exceeded, you can use `customErrorHandler`, like this: ```ts -import { IncomingMessage, ServerResponse } from 'http'; +import type { IncomingMessage, ServerResponse } from 'http'; import type { HttpError } from 'http-errors'; import { JsonBodyParserFramework, JsonBodyParserFrameworkOptions } from '@h4ad/serverless-adapter/lib/frameworks/body-parser';