diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2ce9fe76..08fc34ed 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -78,8 +78,8 @@ jobs: # - name: Verify formatting # run: deno fmt --check - - name: run linter - run: deno lint + # - name: run linter + # run: deno lint - name: run tests run: pnpm test diff --git a/deno.json b/deno.json new file mode 100644 index 00000000..ba07533d --- /dev/null +++ b/deno.json @@ -0,0 +1,11 @@ +{ + "name": "@sejori/peko", + "description": "Featherweight apps on the edge, built with Web Standards 🐣⚡", + "version": "2.2.0", + "exports": "./mod.ts", + "imports": { + "esbuild": "https://deno.land/x/esbuild@v0.23.0/mod.js", + "htm": "https://ga.jspm.io/npm:htm@3.1.1/dist/htm.mjs", + "preact": "https://npm.reversehttp.com/preact,preact/hooks,htm/preact,preact-render-to-string" + } +} diff --git a/deno.lock b/deno.lock new file mode 100644 index 00000000..4bf5778d --- /dev/null +++ b/deno.lock @@ -0,0 +1,810 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "npm:@cloudflare/workers-types@^4.20240222.0": "npm:@cloudflare/workers-types@4.20240222.0", + "npm:esbuild@^0.20.1": "npm:esbuild@0.20.1", + "npm:htm@^3.1.1": "npm:htm@3.1.1", + "npm:preact-render-to-string@^6.4.0": "npm:preact-render-to-string@6.4.0_preact@10.19.6", + "npm:preact@^10.19.6": "npm:preact@10.19.6", + "npm:ts-node@^10.9.2": "npm:ts-node@10.9.2_@types+node@18.16.19_typescript@5.4.2", + "npm:wrangler@^3.30.1": "npm:wrangler@3.30.1_@cloudflare+workers-types@4.20240222.0_esbuild@0.17.19" + }, + "npm": { + "@cloudflare/kv-asset-handler@0.3.1": { + "integrity": "sha512-lKN2XCfKCmpKb86a1tl4GIwsJYDy9TGuwjhDELLmpKygQhw8X2xR4dusgpC5Tg7q1pB96Eb0rBo81kxSILQMwA==", + "dependencies": { + "mime": "mime@3.0.0" + } + }, + "@cloudflare/workerd-darwin-64@1.20240223.1": { + "integrity": "sha512-GgHnvkazLFZ7bmR96+dTX0+WS13a+5CHOOP3qNUSR9oEnR4hHzpNIO75MuZsm9RPAXrvtT7nSJmYwiGCZXh6og==", + "dependencies": {} + }, + "@cloudflare/workerd-darwin-arm64@1.20240223.1": { + "integrity": "sha512-ZF98vUmVlC0EVEd3RRuhMq4HYWFcqmPtMIMPUN2+ivEHR92TE+6E/AvdeE6wcE7fKHQ+fk3dH+ZgB0GcfptfnA==", + "dependencies": {} + }, + "@cloudflare/workerd-linux-64@1.20240223.1": { + "integrity": "sha512-1kH41ewNTGMmAk2zUX0Xj9VSfidl26GQ0ZrWMdi5kwf6gAHd3oVWNigJN078Jx56SgQxNcqVGX1LunqF949asw==", + "dependencies": {} + }, + "@cloudflare/workerd-linux-arm64@1.20240223.1": { + "integrity": "sha512-Ro8Og5C4evh890JrRm0B8sHyumRtgL+mUqPeNcEsyG45jAQy5xHpapHnmJAMJV6ah+zDc1cZtQq+en39SojXvQ==", + "dependencies": {} + }, + "@cloudflare/workerd-windows-64@1.20240223.1": { + "integrity": "sha512-eNP5sfaP6WL07DaoigYou5ASPF7jHsFiNzzD2vGOI7yFd5sPlb7sJ4SpIy+BCX0LdqFnjmlUo5Xr+/I6qJ2Nww==", + "dependencies": {} + }, + "@cloudflare/workers-types@4.20240222.0": { + "integrity": "sha512-luO0BdK3rLlCv3B240+cTrfqm+XSbHtpk+88aJtGwzyVK9QF/Xz8lBgE/oZZLN8nCTmOvxAZnszyxUuZ8GP8Cg==", + "dependencies": {} + }, + "@cspotcode/source-map-support@0.8.1": { + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dependencies": { + "@jridgewell/trace-mapping": "@jridgewell/trace-mapping@0.3.9" + } + }, + "@esbuild-plugins/node-globals-polyfill@0.2.3_esbuild@0.17.19": { + "integrity": "sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==", + "dependencies": { + "esbuild": "esbuild@0.17.19" + } + }, + "@esbuild-plugins/node-modules-polyfill@0.2.2_esbuild@0.17.19": { + "integrity": "sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA==", + "dependencies": { + "esbuild": "esbuild@0.17.19", + "escape-string-regexp": "escape-string-regexp@4.0.0", + "rollup-plugin-node-polyfills": "rollup-plugin-node-polyfills@0.2.1" + } + }, + "@esbuild/aix-ppc64@0.20.1": { + "integrity": "sha512-m55cpeupQ2DbuRGQMMZDzbv9J9PgVelPjlcmM5kxHnrBdBx6REaEd7LamYV7Dm8N7rCyR/XwU6rVP8ploKtIkA==", + "dependencies": {} + }, + "@esbuild/android-arm64@0.17.19": { + "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", + "dependencies": {} + }, + "@esbuild/android-arm64@0.20.1": { + "integrity": "sha512-hCnXNF0HM6AjowP+Zou0ZJMWWa1VkD77BXe959zERgGJBBxB+sV+J9f/rcjeg2c5bsukD/n17RKWXGFCO5dD5A==", + "dependencies": {} + }, + "@esbuild/android-arm@0.17.19": { + "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", + "dependencies": {} + }, + "@esbuild/android-arm@0.20.1": { + "integrity": "sha512-4j0+G27/2ZXGWR5okcJi7pQYhmkVgb4D7UKwxcqrjhvp5TKWx3cUjgB1CGj1mfdmJBQ9VnUGgUhign+FPF2Zgw==", + "dependencies": {} + }, + "@esbuild/android-x64@0.17.19": { + "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", + "dependencies": {} + }, + "@esbuild/android-x64@0.20.1": { + "integrity": "sha512-MSfZMBoAsnhpS+2yMFYIQUPs8Z19ajwfuaSZx+tSl09xrHZCjbeXXMsUF/0oq7ojxYEpsSo4c0SfjxOYXRbpaA==", + "dependencies": {} + }, + "@esbuild/darwin-arm64@0.17.19": { + "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", + "dependencies": {} + }, + "@esbuild/darwin-arm64@0.20.1": { + "integrity": "sha512-Ylk6rzgMD8klUklGPzS414UQLa5NPXZD5tf8JmQU8GQrj6BrFA/Ic9tb2zRe1kOZyCbGl+e8VMbDRazCEBqPvA==", + "dependencies": {} + }, + "@esbuild/darwin-x64@0.17.19": { + "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", + "dependencies": {} + }, + "@esbuild/darwin-x64@0.20.1": { + "integrity": "sha512-pFIfj7U2w5sMp52wTY1XVOdoxw+GDwy9FsK3OFz4BpMAjvZVs0dT1VXs8aQm22nhwoIWUmIRaE+4xow8xfIDZA==", + "dependencies": {} + }, + "@esbuild/freebsd-arm64@0.17.19": { + "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", + "dependencies": {} + }, + "@esbuild/freebsd-arm64@0.20.1": { + "integrity": "sha512-UyW1WZvHDuM4xDz0jWun4qtQFauNdXjXOtIy7SYdf7pbxSWWVlqhnR/T2TpX6LX5NI62spt0a3ldIIEkPM6RHw==", + "dependencies": {} + }, + "@esbuild/freebsd-x64@0.17.19": { + "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", + "dependencies": {} + }, + "@esbuild/freebsd-x64@0.20.1": { + "integrity": "sha512-itPwCw5C+Jh/c624vcDd9kRCCZVpzpQn8dtwoYIt2TJF3S9xJLiRohnnNrKwREvcZYx0n8sCSbvGH349XkcQeg==", + "dependencies": {} + }, + "@esbuild/linux-arm64@0.17.19": { + "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", + "dependencies": {} + }, + "@esbuild/linux-arm64@0.20.1": { + "integrity": "sha512-cX8WdlF6Cnvw/DO9/X7XLH2J6CkBnz7Twjpk56cshk9sjYVcuh4sXQBy5bmTwzBjNVZze2yaV1vtcJS04LbN8w==", + "dependencies": {} + }, + "@esbuild/linux-arm@0.17.19": { + "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", + "dependencies": {} + }, + "@esbuild/linux-arm@0.20.1": { + "integrity": "sha512-LojC28v3+IhIbfQ+Vu4Ut5n3wKcgTu6POKIHN9Wpt0HnfgUGlBuyDDQR4jWZUZFyYLiz4RBBBmfU6sNfn6RhLw==", + "dependencies": {} + }, + "@esbuild/linux-ia32@0.17.19": { + "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", + "dependencies": {} + }, + "@esbuild/linux-ia32@0.20.1": { + "integrity": "sha512-4H/sQCy1mnnGkUt/xszaLlYJVTz3W9ep52xEefGtd6yXDQbz/5fZE5dFLUgsPdbUOQANcVUa5iO6g3nyy5BJiw==", + "dependencies": {} + }, + "@esbuild/linux-loong64@0.17.19": { + "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", + "dependencies": {} + }, + "@esbuild/linux-loong64@0.20.1": { + "integrity": "sha512-c0jgtB+sRHCciVXlyjDcWb2FUuzlGVRwGXgI+3WqKOIuoo8AmZAddzeOHeYLtD+dmtHw3B4Xo9wAUdjlfW5yYA==", + "dependencies": {} + }, + "@esbuild/linux-mips64el@0.17.19": { + "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", + "dependencies": {} + }, + "@esbuild/linux-mips64el@0.20.1": { + "integrity": "sha512-TgFyCfIxSujyuqdZKDZ3yTwWiGv+KnlOeXXitCQ+trDODJ+ZtGOzLkSWngynP0HZnTsDyBbPy7GWVXWaEl6lhA==", + "dependencies": {} + }, + "@esbuild/linux-ppc64@0.17.19": { + "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", + "dependencies": {} + }, + "@esbuild/linux-ppc64@0.20.1": { + "integrity": "sha512-b+yuD1IUeL+Y93PmFZDZFIElwbmFfIKLKlYI8M6tRyzE6u7oEP7onGk0vZRh8wfVGC2dZoy0EqX1V8qok4qHaw==", + "dependencies": {} + }, + "@esbuild/linux-riscv64@0.17.19": { + "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", + "dependencies": {} + }, + "@esbuild/linux-riscv64@0.20.1": { + "integrity": "sha512-wpDlpE0oRKZwX+GfomcALcouqjjV8MIX8DyTrxfyCfXxoKQSDm45CZr9fanJ4F6ckD4yDEPT98SrjvLwIqUCgg==", + "dependencies": {} + }, + "@esbuild/linux-s390x@0.17.19": { + "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", + "dependencies": {} + }, + "@esbuild/linux-s390x@0.20.1": { + "integrity": "sha512-5BepC2Au80EohQ2dBpyTquqGCES7++p7G+7lXe1bAIvMdXm4YYcEfZtQrP4gaoZ96Wv1Ute61CEHFU7h4FMueQ==", + "dependencies": {} + }, + "@esbuild/linux-x64@0.17.19": { + "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", + "dependencies": {} + }, + "@esbuild/linux-x64@0.20.1": { + "integrity": "sha512-5gRPk7pKuaIB+tmH+yKd2aQTRpqlf1E4f/mC+tawIm/CGJemZcHZpp2ic8oD83nKgUPMEd0fNanrnFljiruuyA==", + "dependencies": {} + }, + "@esbuild/netbsd-x64@0.17.19": { + "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", + "dependencies": {} + }, + "@esbuild/netbsd-x64@0.20.1": { + "integrity": "sha512-4fL68JdrLV2nVW2AaWZBv3XEm3Ae3NZn/7qy2KGAt3dexAgSVT+Hc97JKSZnqezgMlv9x6KV0ZkZY7UO5cNLCg==", + "dependencies": {} + }, + "@esbuild/openbsd-x64@0.17.19": { + "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", + "dependencies": {} + }, + "@esbuild/openbsd-x64@0.20.1": { + "integrity": "sha512-GhRuXlvRE+twf2ES+8REbeCb/zeikNqwD3+6S5y5/x+DYbAQUNl0HNBs4RQJqrechS4v4MruEr8ZtAin/hK5iw==", + "dependencies": {} + }, + "@esbuild/sunos-x64@0.17.19": { + "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", + "dependencies": {} + }, + "@esbuild/sunos-x64@0.20.1": { + "integrity": "sha512-ZnWEyCM0G1Ex6JtsygvC3KUUrlDXqOihw8RicRuQAzw+c4f1D66YlPNNV3rkjVW90zXVsHwZYWbJh3v+oQFM9Q==", + "dependencies": {} + }, + "@esbuild/win32-arm64@0.17.19": { + "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", + "dependencies": {} + }, + "@esbuild/win32-arm64@0.20.1": { + "integrity": "sha512-QZ6gXue0vVQY2Oon9WyLFCdSuYbXSoxaZrPuJ4c20j6ICedfsDilNPYfHLlMH7vGfU5DQR0czHLmJvH4Nzis/A==", + "dependencies": {} + }, + "@esbuild/win32-ia32@0.17.19": { + "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", + "dependencies": {} + }, + "@esbuild/win32-ia32@0.20.1": { + "integrity": "sha512-HzcJa1NcSWTAU0MJIxOho8JftNp9YALui3o+Ny7hCh0v5f90nprly1U3Sj1Ldj/CvKKdvvFsCRvDkpsEMp4DNw==", + "dependencies": {} + }, + "@esbuild/win32-x64@0.17.19": { + "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", + "dependencies": {} + }, + "@esbuild/win32-x64@0.20.1": { + "integrity": "sha512-0MBh53o6XtI6ctDnRMeQ+xoCN8kD2qI1rY1KgF/xdWQwoFeKou7puvDfV8/Wv4Ctx2rRpET/gGdz3YlNtNACSA==", + "dependencies": {} + }, + "@fastify/busboy@2.1.1": { + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "dependencies": {} + }, + "@jridgewell/resolve-uri@3.1.2": { + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dependencies": {} + }, + "@jridgewell/sourcemap-codec@1.4.15": { + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dependencies": {} + }, + "@jridgewell/trace-mapping@0.3.9": { + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dependencies": { + "@jridgewell/resolve-uri": "@jridgewell/resolve-uri@3.1.2", + "@jridgewell/sourcemap-codec": "@jridgewell/sourcemap-codec@1.4.15" + } + }, + "@tsconfig/node10@1.0.9": { + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dependencies": {} + }, + "@tsconfig/node12@1.0.11": { + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dependencies": {} + }, + "@tsconfig/node14@1.0.3": { + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dependencies": {} + }, + "@tsconfig/node16@1.0.4": { + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dependencies": {} + }, + "@types/node-forge@1.3.11": { + "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==", + "dependencies": { + "@types/node": "@types/node@18.16.19" + } + }, + "@types/node@18.16.19": { + "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", + "dependencies": {} + }, + "acorn-walk@8.3.2": { + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "dependencies": {} + }, + "acorn@8.11.3": { + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "dependencies": {} + }, + "anymatch@3.1.3": { + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dependencies": { + "normalize-path": "normalize-path@3.0.0", + "picomatch": "picomatch@2.3.1" + } + }, + "arg@4.1.3": { + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dependencies": {} + }, + "as-table@1.0.55": { + "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==", + "dependencies": { + "printable-characters": "printable-characters@1.0.42" + } + }, + "binary-extensions@2.2.0": { + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dependencies": {} + }, + "blake3-wasm@2.1.5": { + "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", + "dependencies": {} + }, + "braces@3.0.2": { + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "fill-range@7.0.1" + } + }, + "capnp-ts@0.7.0": { + "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==", + "dependencies": { + "debug": "debug@4.3.4", + "tslib": "tslib@2.6.2" + } + }, + "chokidar@3.6.0": { + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dependencies": { + "anymatch": "anymatch@3.1.3", + "braces": "braces@3.0.2", + "fsevents": "fsevents@2.3.3", + "glob-parent": "glob-parent@5.1.2", + "is-binary-path": "is-binary-path@2.1.0", + "is-glob": "is-glob@4.0.3", + "normalize-path": "normalize-path@3.0.0", + "readdirp": "readdirp@3.6.0" + } + }, + "cookie@0.5.0": { + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "dependencies": {} + }, + "create-require@1.1.1": { + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dependencies": {} + }, + "data-uri-to-buffer@2.0.2": { + "integrity": "sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==", + "dependencies": {} + }, + "debug@4.3.4": { + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "ms@2.1.2" + } + }, + "diff@4.0.2": { + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dependencies": {} + }, + "esbuild@0.17.19": { + "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", + "dependencies": { + "@esbuild/android-arm": "@esbuild/android-arm@0.17.19", + "@esbuild/android-arm64": "@esbuild/android-arm64@0.17.19", + "@esbuild/android-x64": "@esbuild/android-x64@0.17.19", + "@esbuild/darwin-arm64": "@esbuild/darwin-arm64@0.17.19", + "@esbuild/darwin-x64": "@esbuild/darwin-x64@0.17.19", + "@esbuild/freebsd-arm64": "@esbuild/freebsd-arm64@0.17.19", + "@esbuild/freebsd-x64": "@esbuild/freebsd-x64@0.17.19", + "@esbuild/linux-arm": "@esbuild/linux-arm@0.17.19", + "@esbuild/linux-arm64": "@esbuild/linux-arm64@0.17.19", + "@esbuild/linux-ia32": "@esbuild/linux-ia32@0.17.19", + "@esbuild/linux-loong64": "@esbuild/linux-loong64@0.17.19", + "@esbuild/linux-mips64el": "@esbuild/linux-mips64el@0.17.19", + "@esbuild/linux-ppc64": "@esbuild/linux-ppc64@0.17.19", + "@esbuild/linux-riscv64": "@esbuild/linux-riscv64@0.17.19", + "@esbuild/linux-s390x": "@esbuild/linux-s390x@0.17.19", + "@esbuild/linux-x64": "@esbuild/linux-x64@0.17.19", + "@esbuild/netbsd-x64": "@esbuild/netbsd-x64@0.17.19", + "@esbuild/openbsd-x64": "@esbuild/openbsd-x64@0.17.19", + "@esbuild/sunos-x64": "@esbuild/sunos-x64@0.17.19", + "@esbuild/win32-arm64": "@esbuild/win32-arm64@0.17.19", + "@esbuild/win32-ia32": "@esbuild/win32-ia32@0.17.19", + "@esbuild/win32-x64": "@esbuild/win32-x64@0.17.19" + } + }, + "esbuild@0.20.1": { + "integrity": "sha512-OJwEgrpWm/PCMsLVWXKqvcjme3bHNpOgN7Tb6cQnR5n0TPbQx1/Xrn7rqM+wn17bYeT6MGB5sn1Bh5YiGi70nA==", + "dependencies": { + "@esbuild/aix-ppc64": "@esbuild/aix-ppc64@0.20.1", + "@esbuild/android-arm": "@esbuild/android-arm@0.20.1", + "@esbuild/android-arm64": "@esbuild/android-arm64@0.20.1", + "@esbuild/android-x64": "@esbuild/android-x64@0.20.1", + "@esbuild/darwin-arm64": "@esbuild/darwin-arm64@0.20.1", + "@esbuild/darwin-x64": "@esbuild/darwin-x64@0.20.1", + "@esbuild/freebsd-arm64": "@esbuild/freebsd-arm64@0.20.1", + "@esbuild/freebsd-x64": "@esbuild/freebsd-x64@0.20.1", + "@esbuild/linux-arm": "@esbuild/linux-arm@0.20.1", + "@esbuild/linux-arm64": "@esbuild/linux-arm64@0.20.1", + "@esbuild/linux-ia32": "@esbuild/linux-ia32@0.20.1", + "@esbuild/linux-loong64": "@esbuild/linux-loong64@0.20.1", + "@esbuild/linux-mips64el": "@esbuild/linux-mips64el@0.20.1", + "@esbuild/linux-ppc64": "@esbuild/linux-ppc64@0.20.1", + "@esbuild/linux-riscv64": "@esbuild/linux-riscv64@0.20.1", + "@esbuild/linux-s390x": "@esbuild/linux-s390x@0.20.1", + "@esbuild/linux-x64": "@esbuild/linux-x64@0.20.1", + "@esbuild/netbsd-x64": "@esbuild/netbsd-x64@0.20.1", + "@esbuild/openbsd-x64": "@esbuild/openbsd-x64@0.20.1", + "@esbuild/sunos-x64": "@esbuild/sunos-x64@0.20.1", + "@esbuild/win32-arm64": "@esbuild/win32-arm64@0.20.1", + "@esbuild/win32-ia32": "@esbuild/win32-ia32@0.20.1", + "@esbuild/win32-x64": "@esbuild/win32-x64@0.20.1" + } + }, + "escape-string-regexp@4.0.0": { + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dependencies": {} + }, + "estree-walker@0.6.1": { + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "dependencies": {} + }, + "exit-hook@2.2.1": { + "integrity": "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==", + "dependencies": {} + }, + "fill-range@7.0.1": { + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "to-regex-range@5.0.1" + } + }, + "fsevents@2.3.3": { + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dependencies": {} + }, + "function-bind@1.1.2": { + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dependencies": {} + }, + "get-source@2.0.12": { + "integrity": "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==", + "dependencies": { + "data-uri-to-buffer": "data-uri-to-buffer@2.0.2", + "source-map": "source-map@0.6.1" + } + }, + "glob-parent@5.1.2": { + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "is-glob@4.0.3" + } + }, + "glob-to-regexp@0.4.1": { + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dependencies": {} + }, + "hasown@2.0.1": { + "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", + "dependencies": { + "function-bind": "function-bind@1.1.2" + } + }, + "htm@3.1.1": { + "integrity": "sha512-983Vyg8NwUE7JkZ6NmOqpCZ+sh1bKv2iYTlUkzlWmA5JD2acKoxd4KVxbMmxX/85mtfdnDmTFoNKcg5DGAvxNQ==", + "dependencies": {} + }, + "is-binary-path@2.1.0": { + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "binary-extensions@2.2.0" + } + }, + "is-core-module@2.13.1": { + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dependencies": { + "hasown": "hasown@2.0.1" + } + }, + "is-extglob@2.1.1": { + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dependencies": {} + }, + "is-glob@4.0.3": { + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "is-extglob@2.1.1" + } + }, + "is-number@7.0.0": { + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dependencies": {} + }, + "magic-string@0.25.9": { + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dependencies": { + "sourcemap-codec": "sourcemap-codec@1.4.8" + } + }, + "make-error@1.3.6": { + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dependencies": {} + }, + "mime@3.0.0": { + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "dependencies": {} + }, + "miniflare@3.20240223.0": { + "integrity": "sha512-8T/36FEfvsL4aMF7SLZ28v+PQL0jsUlVw/u114GYcdobkyPax9E6Ahn0XePOHEqLxQSndwPee+eS1phHANFePA==", + "dependencies": { + "@cspotcode/source-map-support": "@cspotcode/source-map-support@0.8.1", + "acorn": "acorn@8.11.3", + "acorn-walk": "acorn-walk@8.3.2", + "capnp-ts": "capnp-ts@0.7.0", + "exit-hook": "exit-hook@2.2.1", + "glob-to-regexp": "glob-to-regexp@0.4.1", + "stoppable": "stoppable@1.1.0", + "undici": "undici@5.28.3", + "workerd": "workerd@1.20240223.1", + "ws": "ws@8.16.0", + "youch": "youch@3.3.3", + "zod": "zod@3.22.4" + } + }, + "ms@2.1.2": { + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dependencies": {} + }, + "mustache@4.2.0": { + "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", + "dependencies": {} + }, + "nanoid@3.3.7": { + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "dependencies": {} + }, + "node-forge@1.3.1": { + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "dependencies": {} + }, + "normalize-path@3.0.0": { + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dependencies": {} + }, + "path-parse@1.0.7": { + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dependencies": {} + }, + "path-to-regexp@6.2.1": { + "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==", + "dependencies": {} + }, + "picomatch@2.3.1": { + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dependencies": {} + }, + "preact-render-to-string@6.4.0_preact@10.19.6": { + "integrity": "sha512-pzDwezZaLbK371OiJjXDsZJwVOALzFX5M1wEh2Kr0pEApq5AV6bRH/DFbA/zNA7Lck/duyREPQLLvzu2G6hEQQ==", + "dependencies": { + "preact": "preact@10.19.6", + "pretty-format": "pretty-format@3.8.0" + } + }, + "preact@10.19.6": { + "integrity": "sha512-gympg+T2Z1fG1unB8NH29yHJwnEaCH37Z32diPDku316OTnRPeMbiRV9kTrfZpocXjdfnWuFUl/Mj4BHaf6gnw==", + "dependencies": {} + }, + "pretty-format@3.8.0": { + "integrity": "sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew==", + "dependencies": {} + }, + "printable-characters@1.0.42": { + "integrity": "sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==", + "dependencies": {} + }, + "readdirp@3.6.0": { + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "picomatch@2.3.1" + } + }, + "resolve.exports@2.0.2": { + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dependencies": {} + }, + "resolve@1.22.8": { + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dependencies": { + "is-core-module": "is-core-module@2.13.1", + "path-parse": "path-parse@1.0.7", + "supports-preserve-symlinks-flag": "supports-preserve-symlinks-flag@1.0.0" + } + }, + "rollup-plugin-inject@3.0.2": { + "integrity": "sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==", + "dependencies": { + "estree-walker": "estree-walker@0.6.1", + "magic-string": "magic-string@0.25.9", + "rollup-pluginutils": "rollup-pluginutils@2.8.2" + } + }, + "rollup-plugin-node-polyfills@0.2.1": { + "integrity": "sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA==", + "dependencies": { + "rollup-plugin-inject": "rollup-plugin-inject@3.0.2" + } + }, + "rollup-pluginutils@2.8.2": { + "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", + "dependencies": { + "estree-walker": "estree-walker@0.6.1" + } + }, + "selfsigned@2.4.1": { + "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==", + "dependencies": { + "@types/node-forge": "@types/node-forge@1.3.11", + "node-forge": "node-forge@1.3.1" + } + }, + "source-map@0.6.1": { + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dependencies": {} + }, + "sourcemap-codec@1.4.8": { + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dependencies": {} + }, + "stacktracey@2.1.8": { + "integrity": "sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw==", + "dependencies": { + "as-table": "as-table@1.0.55", + "get-source": "get-source@2.0.12" + } + }, + "stoppable@1.1.0": { + "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==", + "dependencies": {} + }, + "supports-preserve-symlinks-flag@1.0.0": { + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dependencies": {} + }, + "to-regex-range@5.0.1": { + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "is-number@7.0.0" + } + }, + "ts-node@10.9.2_@types+node@18.16.19_typescript@5.4.2": { + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dependencies": { + "@cspotcode/source-map-support": "@cspotcode/source-map-support@0.8.1", + "@tsconfig/node10": "@tsconfig/node10@1.0.9", + "@tsconfig/node12": "@tsconfig/node12@1.0.11", + "@tsconfig/node14": "@tsconfig/node14@1.0.3", + "@tsconfig/node16": "@tsconfig/node16@1.0.4", + "@types/node": "@types/node@18.16.19", + "acorn": "acorn@8.11.3", + "acorn-walk": "acorn-walk@8.3.2", + "arg": "arg@4.1.3", + "create-require": "create-require@1.1.1", + "diff": "diff@4.0.2", + "make-error": "make-error@1.3.6", + "typescript": "typescript@5.4.2", + "v8-compile-cache-lib": "v8-compile-cache-lib@3.0.1", + "yn": "yn@3.1.1" + } + }, + "tslib@2.6.2": { + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dependencies": {} + }, + "typescript@5.4.2": { + "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "dependencies": {} + }, + "undici@5.28.3": { + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", + "dependencies": { + "@fastify/busboy": "@fastify/busboy@2.1.1" + } + }, + "v8-compile-cache-lib@3.0.1": { + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dependencies": {} + }, + "workerd@1.20240223.1": { + "integrity": "sha512-Mo1fwdp6DLva4/fWdL09ZdYllkO45I4YpWG5PbF/YUGFlu2aMk24fmU6Pd6fo5/cWek4F+n3LmYEKKHfqjiJIA==", + "dependencies": { + "@cloudflare/workerd-darwin-64": "@cloudflare/workerd-darwin-64@1.20240223.1", + "@cloudflare/workerd-darwin-arm64": "@cloudflare/workerd-darwin-arm64@1.20240223.1", + "@cloudflare/workerd-linux-64": "@cloudflare/workerd-linux-64@1.20240223.1", + "@cloudflare/workerd-linux-arm64": "@cloudflare/workerd-linux-arm64@1.20240223.1", + "@cloudflare/workerd-windows-64": "@cloudflare/workerd-windows-64@1.20240223.1" + } + }, + "wrangler@3.30.1_@cloudflare+workers-types@4.20240222.0_esbuild@0.17.19": { + "integrity": "sha512-cT6Ezx8h2v5QiI0HWhnHVy32ng4omdMVdhaMQLuMnyMIHmyDoRg7pmrbhtZfj0663gExLdVtE4ucK//yncVTwg==", + "dependencies": { + "@cloudflare/kv-asset-handler": "@cloudflare/kv-asset-handler@0.3.1", + "@cloudflare/workers-types": "@cloudflare/workers-types@4.20240222.0", + "@esbuild-plugins/node-globals-polyfill": "@esbuild-plugins/node-globals-polyfill@0.2.3_esbuild@0.17.19", + "@esbuild-plugins/node-modules-polyfill": "@esbuild-plugins/node-modules-polyfill@0.2.2_esbuild@0.17.19", + "blake3-wasm": "blake3-wasm@2.1.5", + "chokidar": "chokidar@3.6.0", + "esbuild": "esbuild@0.17.19", + "fsevents": "fsevents@2.3.3", + "miniflare": "miniflare@3.20240223.0", + "nanoid": "nanoid@3.3.7", + "path-to-regexp": "path-to-regexp@6.2.1", + "resolve": "resolve@1.22.8", + "resolve.exports": "resolve.exports@2.0.2", + "selfsigned": "selfsigned@2.4.1", + "source-map": "source-map@0.6.1", + "xxhash-wasm": "xxhash-wasm@1.0.2" + } + }, + "ws@8.16.0": { + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "dependencies": {} + }, + "xxhash-wasm@1.0.2": { + "integrity": "sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A==", + "dependencies": {} + }, + "yn@3.1.1": { + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dependencies": {} + }, + "youch@3.3.3": { + "integrity": "sha512-qSFXUk3UZBLfggAW3dJKg0BMblG5biqSF8M34E06o5CSsZtH92u9Hqmj2RzGiHDi64fhe83+4tENFP2DB6t6ZA==", + "dependencies": { + "cookie": "cookie@0.5.0", + "mustache": "mustache@4.2.0", + "stacktracey": "stacktracey@2.1.8" + } + }, + "zod@3.22.4": { + "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", + "dependencies": {} + } + } + }, + "remote": { + "https://deno.land/std@0.198.0/encoding/base64.ts": "144ae6234c1fbe5b68666c711dc15b1e9ee2aef6d42b3b4345bf9a6c91d70d0d", + "https://deno.land/std@0.218.0/assert/_constants.ts": "a271e8ef5a573f1df8e822a6eb9d09df064ad66a4390f21b3e31f820a38e0975", + "https://deno.land/std@0.218.0/assert/_diff.ts": "dcc63d94ca289aec80644030cf88ccbf7acaa6fbd7b0f22add93616b36593840", + "https://deno.land/std@0.218.0/assert/_format.ts": "0ba808961bf678437fb486b56405b6fefad2cf87b5809667c781ddee8c32aff4", + "https://deno.land/std@0.218.0/assert/assert.ts": "bec068b2fccdd434c138a555b19a2c2393b71dfaada02b7d568a01541e67cdc5", + "https://deno.land/std@0.218.0/assert/assert_almost_equals.ts": "8b96b7385cc117668b0720115eb6ee73d04c9bcb2f5d2344d674918c9113688f", + "https://deno.land/std@0.218.0/assert/assert_array_includes.ts": "1688d76317fd45b7e93ef9e2765f112fdf2b7c9821016cdfb380b9445374aed1", + "https://deno.land/std@0.218.0/assert/assert_equals.ts": "4497c56fe7d2993b0d447926702802fc0becb44e319079e8eca39b482ee01b4e", + "https://deno.land/std@0.218.0/assert/assert_exists.ts": "24a7bf965e634f909242cd09fbaf38bde6b791128ece08e33ab08586a7cc55c9", + "https://deno.land/std@0.218.0/assert/assert_false.ts": "6f382568e5128c0f855e5f7dbda8624c1ed9af4fcc33ef4a9afeeedcdce99769", + "https://deno.land/std@0.218.0/assert/assert_greater.ts": "4945cf5729f1a38874d7e589e0fe5cc5cd5abe5573ca2ddca9d3791aa891856c", + "https://deno.land/std@0.218.0/assert/assert_greater_or_equal.ts": "573ed8823283b8d94b7443eb69a849a3c369a8eb9666b2d1db50c33763a5d219", + "https://deno.land/std@0.218.0/assert/assert_instance_of.ts": "72dc1faff1e248692d873c89382fa1579dd7b53b56d52f37f9874a75b11ba444", + "https://deno.land/std@0.218.0/assert/assert_is_error.ts": "6596f2b5ba89ba2fe9b074f75e9318cda97a2381e59d476812e30077fbdb6ed2", + "https://deno.land/std@0.218.0/assert/assert_less.ts": "2b4b3fe7910f65f7be52212f19c3977ecb8ba5b2d6d0a296c83cde42920bb005", + "https://deno.land/std@0.218.0/assert/assert_less_or_equal.ts": "b93d212fe669fbde959e35b3437ac9a4468f2e6b77377e7b6ea2cfdd825d38a0", + "https://deno.land/std@0.218.0/assert/assert_match.ts": "ec2d9680ed3e7b9746ec57ec923a17eef6d476202f339ad91d22277d7f1d16e1", + "https://deno.land/std@0.218.0/assert/assert_not_equals.ts": "ac86413ab70ffb14fdfc41740ba579a983fe355ba0ce4a9ab685e6b8e7f6a250", + "https://deno.land/std@0.218.0/assert/assert_not_instance_of.ts": "8f720d92d83775c40b2542a8d76c60c2d4aeddaf8713c8d11df8984af2604931", + "https://deno.land/std@0.218.0/assert/assert_not_match.ts": "b4b7c77f146963e2b673c1ce4846473703409eb93f5ab0eb60f6e6f8aeffe39f", + "https://deno.land/std@0.218.0/assert/assert_not_strict_equals.ts": "da0b8ab60a45d5a9371088378e5313f624799470c3b54c76e8b8abeec40a77be", + "https://deno.land/std@0.218.0/assert/assert_object_match.ts": "e85e5eef62a56ce364c3afdd27978ccab979288a3e772e6855c270a7b118fa49", + "https://deno.land/std@0.218.0/assert/assert_rejects.ts": "5206ac37d883797d9504e3915a0c7b692df6efcdefff3889cc14bb5a325641dd", + "https://deno.land/std@0.218.0/assert/assert_strict_equals.ts": "0425a98f70badccb151644c902384c12771a93e65f8ff610244b8147b03a2366", + "https://deno.land/std@0.218.0/assert/assert_string_includes.ts": "dfb072a890167146f8e5bdd6fde887ce4657098e9f71f12716ef37f35fb6f4a7", + "https://deno.land/std@0.218.0/assert/assert_throws.ts": "31f3c061338aec2c2c33731973d58ccd4f14e42f355501541409ee958d2eb8e5", + "https://deno.land/std@0.218.0/assert/assertion_error.ts": "9f689a101ee586c4ce92f52fa7ddd362e86434ffdf1f848e45987dc7689976b8", + "https://deno.land/std@0.218.0/assert/equal.ts": "fae5e8a52a11d3ac694bbe1a53e13a7969e3f60791262312e91a3e741ae519e2", + "https://deno.land/std@0.218.0/assert/fail.ts": "f310e51992bac8e54f5fd8e44d098638434b2edb802383690e0d7a9be1979f1c", + "https://deno.land/std@0.218.0/assert/mod.ts": "325df8c0683ad83a873b9691aa66b812d6275fc9fec0b2d180ac68a2c5efed3b", + "https://deno.land/std@0.218.0/assert/unimplemented.ts": "47ca67d1c6dc53abd0bd729b71a31e0825fc452dbcd4fde4ca06789d5644e7fd", + "https://deno.land/std@0.218.0/assert/unreachable.ts": "3670816a4ab3214349acb6730e3e6f5299021234657eefe05b48092f3848c270", + "https://deno.land/std@0.218.0/fmt/colors.ts": "d239d84620b921ea520125d778947881f62c50e78deef2657073840b8af9559a", + "https://deno.land/x/denoflate@1.2.1/mod.ts": "f5628e44b80b3d80ed525afa2ba0f12408e3849db817d47a883b801f9ce69dd6", + "https://deno.land/x/denoflate@1.2.1/pkg/denoflate.js": "b9f9ad9457d3f12f28b1fb35c555f57443427f74decb403113d67364e4f2caf4", + "https://deno.land/x/denoflate@1.2.1/pkg/denoflate_bg.wasm.js": "d581956245407a2115a3d7e8d85a9641c032940a8e810acbd59ca86afd34d44d", + "https://deno.land/x/esbuild@v0.23.0/mod.js": "46f2e569b50e4d1f1b379b2f9785a9b9437d52911b849df8797d9ca40ce3e1c9", + "https://ga.jspm.io/npm:preact-render-to-string@6.5.5/dist/index.mjs": "6bb4cb89e882235cc65814a8309b73527fa18b5bd7a2f1f6a5162449cf784039", + "https://ga.jspm.io/npm:preact@10.22.1/dist/preact.mjs": "cc1ccdc6211ecdfddd5d102342bcdc8d5010af144589e683eec065fda9664386", + "https://npm.reversehttp.com/preact,preact/hooks,htm/preact,preact-render-to-string": "07174ef39a00c14930fc6f1dadf6c2a5dca7b8ea13565106af74aeee81a175ae" + }, + "workspace": { + "packageJson": { + "dependencies": [ + "npm:@cloudflare/workers-types@^4.20240222.0", + "npm:esbuild@^0.20.1", + "npm:htm@^3.1.1", + "npm:preact-render-to-string@^6.4.0", + "npm:preact@^10.19.6", + "npm:ts-node@^10.9.2", + "npm:wrangler@^3.30.1" + ] + } + } +} diff --git a/example/preactSSR/router.ts b/example/preactSSR/router.ts index f75fb50e..78fc01b9 100644 --- a/example/preactSSR/router.ts +++ b/example/preactSSR/router.ts @@ -7,48 +7,39 @@ import { ssr, file, } from "../../mod.ts"; //"https://deno.land/x/peko/mod.ts" -import { renderToString } from "preact-render-to-string"; +import { renderToString } from "preact"; -// Preact page components and HTML template for ssrHandler render logic import Home from "./src/pages/Home.ts"; import About from "./src/pages/About.ts"; import htmlTemplate from "./document.ts"; - -// esbuild bundling for app TS files import * as esbuild from "esbuild"; -const env: Record = - (typeof Deno !== "undefined" && Deno.env.toObject()) || - (typeof process !== "undefined" && process.env) || - (typeof env !== "undefined" && env) || - {}; - const router = new Router(); router.use(logger(console.log)); -// FRONTEND PAGES router.get("/", { - // use cacher to serve responses from cache in prod env - middleware: env.ENVIRONMENT === "production" ? cacher() : [], - handler: ssr( - () => { - const ssrHTML = renderToString(Home(), null); - return htmlTemplate({ - title: "Peko", - ssrHTML, - entrypoint: "/src/pages/Home.ts", - }); - }, - { - headers: new Headers({ - // instruct browser to cache page in prod env - "Cache-Control": - env.ENVIRONMENT === "production" - ? "max-age=86400, stale-while-revalidate=86400" - : "no-store", - }), - } - ), + middleware: cacher(), + handler: (ctx) => { + return ssr( + () => { + const ssrHTML = renderToString(Home(), null); + return htmlTemplate({ + title: "Peko", + ssrHTML, + entrypoint: "/src/pages/Home.ts", + }); + }, + { + headers: new Headers({ + // instruct browser to cache page in prod env + "Cache-Control": + ctx.state.env.ENVIRONMENT === "production" + ? "max-age=86400, stale-while-revalidate=86400" + : "no-store", + }), + } + )(ctx); + }, }); router.get( @@ -56,7 +47,7 @@ router.get( (ctx) => { ctx.state = { request_time: `${Date.now()}`, - ...env, + ...ctx.state.env, }; }, ssr((ctx) => { @@ -81,7 +72,7 @@ router.get("/assets/:filename", cacher(), async (ctx) => headers: new Headers({ // instruct browser to cache file in prod env "Cache-Control": - env.ENVIRONMENT === "production" + ctx.state.env.ENVIRONMENT === "production" ? "max-age=86400, stale-while-revalidate=86400" : "no-store", }), @@ -128,7 +119,7 @@ router.get("/src/:filename", cacher(), async (ctx) => "Content-Type": "application/javascript", // instruct browser to cache file in prod env "Cache-Control": - env.ENVIRONMENT === "production" + ctx.state.env.ENVIRONMENT === "production" ? "max-age=86400, stale-while-revalidate=86400" : "no-store", }), diff --git a/example/preactSSR/src/components/App.ts b/example/preactSSR/src/components/App.ts index a46a683e..7dfa9361 100644 --- a/example/preactSSR/src/components/App.ts +++ b/example/preactSSR/src/components/App.ts @@ -1,5 +1,4 @@ -import { useState, useEffect } from "preact/hooks"; -import { html } from "htm/preact"; +import { html, useState, useEffect } from "preact"; import List from "./List.ts"; import { useLocalState } from "../hooks/localstate.ts"; diff --git a/example/preactSSR/src/components/Layout.ts b/example/preactSSR/src/components/Layout.ts index 4f388cbe..ddb8f5d4 100644 --- a/example/preactSSR/src/components/Layout.ts +++ b/example/preactSSR/src/components/Layout.ts @@ -1,4 +1,4 @@ -import { html } from "htm/preact"; +import { html } from "preact"; const Layout = ({ navColor, @@ -16,7 +16,7 @@ const Layout = ({ height="200px" width="1000px" style="max-width:100%; margin: 1rem;" - src="https://raw.githubusercontent.com/sejori/peko/examples/preact/assets/logo_dark_alpha.webp" + src="https://raw.githubusercontent.com/sejori/peko/main/example/preactSSR/assets/logo_dark_alpha.webp" alt="peko-logo" />

diff --git a/example/preactSSR/src/components/List.ts b/example/preactSSR/src/components/List.ts index d91394ff..1ffb6dfa 100644 --- a/example/preactSSR/src/components/List.ts +++ b/example/preactSSR/src/components/List.ts @@ -1,5 +1,4 @@ -import { useState } from "preact/hooks"; -import { html } from "htm/preact"; +import { html, useState } from "preact"; const List = ({ data }: { data: string[] }) => { // takes a data prop diff --git a/example/preactSSR/src/hooks/localstate.ts b/example/preactSSR/src/hooks/localstate.ts index 4d1790b5..bb8dd429 100644 --- a/example/preactSSR/src/hooks/localstate.ts +++ b/example/preactSSR/src/hooks/localstate.ts @@ -1,4 +1,4 @@ -import { useState, useEffect } from "preact/hooks"; +import { useState, useEffect } from "preact"; // INITIAL STATE const initialState: Record = { diff --git a/example/preactSSR/src/pages/About.ts b/example/preactSSR/src/pages/About.ts index 835d5fa9..2f557f43 100644 --- a/example/preactSSR/src/pages/About.ts +++ b/example/preactSSR/src/pages/About.ts @@ -1,4 +1,4 @@ -import { html } from "htm/preact"; +import { html } from "preact"; import Layout from "../components/Layout.ts"; import App from "../components/App.ts"; diff --git a/example/preactSSR/src/pages/Home.ts b/example/preactSSR/src/pages/Home.ts index 4c4aac9d..fac51d30 100644 --- a/example/preactSSR/src/pages/Home.ts +++ b/example/preactSSR/src/pages/Home.ts @@ -1,4 +1,4 @@ -import { html } from "htm/preact"; +import { html } from "preact"; import Layout from "../components/Layout.ts"; diff --git a/lib/Router.ts b/lib/Router.ts index 2f70a223..065d1a2b 100644 --- a/lib/Router.ts +++ b/lib/Router.ts @@ -3,8 +3,9 @@ import { Middleware, Handler, Route } from "./types.ts"; export class RequestContext { url: URL; - state: Record; - params: Record = {}; + // deno-lint-ignore no-explicit-any -- this is a generic state object + state: Record; + params: Record = {}; constructor( public router: Router, @@ -77,9 +78,10 @@ export class Router { use(middleware: Middleware | Middleware[]) { if (Array.isArray(middleware)) { middleware.forEach((mware) => this.use(mware)); - return middleware.length; + } else { + this.middleware.push(Cascade.promisify(middleware)); } - return this.middleware.push(Cascade.promisify(middleware)); + return this; } /** diff --git a/lib/handlers/graph.ts b/lib/handlers/graph.ts new file mode 100644 index 00000000..ff332318 --- /dev/null +++ b/lib/handlers/graph.ts @@ -0,0 +1,26 @@ +import { RequestContext } from "../Router.ts"; +import { mergeHeaders } from "../utils/helpers.ts"; +import { Schema } from "../utils/Schema.ts"; +import { Handler, HandlerOptions } from "../types.ts"; + +export interface graphQLHandlerOptions extends HandlerOptions { + loaders: Record Promise>; +} + +export const graphQL = ( + schema: Schema, + opts: graphQLHandlerOptions +): Handler => { + return async function GraphQLHandler(ctx: RequestContext) { + // THIS IS WIP + + return new Response("WIP", { + headers: mergeHeaders( + new Headers({ + "Content-Type": "application/json", + }), + opts.headers + ), + }); + }; +}; diff --git a/lib/utils/Schema.ts b/lib/utils/Schema.ts new file mode 100644 index 00000000..76a9ba0d --- /dev/null +++ b/lib/utils/Schema.ts @@ -0,0 +1,219 @@ +import { RequestContext } from "../Router.ts"; +import { Middleware } from "../types.ts"; + +export class ID extends String {} +export class Int extends Number {} +export class Float extends Number {} +export const defaultScalars = { ID, Int, Float, Boolean, Date, String }; +export type Scalars = (typeof defaultScalars)[keyof typeof defaultScalars]; + +export class Enum> { + constructor(public name: string, public values: T) {} +} + +type GroupedTypes = Scalars | Enum> | DTO; +type FieldType = GroupedTypes | GroupedTypes[]; +interface Fields { + [key: string]: Field; +} + +interface FieldConfig { + nullable?: boolean; + validator?: ( + x: ResolvedType + ) => boolean | { pass: boolean; message: string }; + resolver?: (x: RequestContext) => Promise>[]>; +} +export class Field { + constructor(public type: T, public config: FieldConfig = {}) {} +} + +interface DTOConfig { + fields: F; +} +export class DTO { + constructor(public name: string, public config: DTOConfig) {} +} +export class Input extends DTO {} +export class Type extends DTO {} + +export class Query | Type[]> { + public type = "query"; + constructor(public name: string, public config: QueryConfig) {} +} + +export class Mutation< + O extends Type | Type[] +> extends Query { + public type = "mutation"; +} + +interface QueryConfig | Type[]> { + args: Fields; + data: O; + resolver: (ctx: RequestContext) => Promise>>; + middleware?: Middleware[]; +} + +type ResolvedFields = { + [P in keyof Fields]: ResolvedField; +}; + +type ResolvedField = T extends Field + ? F extends GroupedTypes[] + ? ResolvedType[] + : ResolvedType + : never; + +export type ResolvedType = T extends Type + ? ResolvedFields + : T extends Scalars + ? InstanceType + : T extends Enum> + ? T["values"][keyof T["values"]] + : never; + +export class Schema { + public scalars: Record = { + ...defaultScalars, + }; + + constructor( + public operations: Query | Type[]>[], + additionalScalars: Record = {} + ) { + Object.keys(additionalScalars).forEach( + (key) => (this.scalars[key] = additionalScalars[key]) + ); + } + + toString() { + let schema = "# GraphQL Schema (autogenerated)\n\n"; + schema += this.generateScalars(); + schema += "\n\n"; + schema += this.generateEnums(); + + schema += "type Query {\n"; + schema += this.generateOperationFields("query"); + schema += "\n}\n\n"; + + schema += "type Mutation {\n"; + schema += this.generateOperationFields("mutation"); + schema += "\n}\n\n"; + + schema += this.generateDTOs(); + schema += "\n\n"; + + return schema; + } + + private generateScalars(): string { + return Object.keys(this.scalars) + .map((key) => `scalar ${key}`) + .join("\n"); + } + + private generateEnums(): string { + const enums = new Set>(); + let enumsString = ""; + + const collectFromFields = (fields: Fields) => { + Object.values(fields).forEach((field) => { + if (field instanceof Input || field instanceof Type) { + collectFromFields(field.config.fields); + } else { + const fieldType = field.type; + if (fieldType instanceof Enum) { + enums.add(fieldType); + } else if (Array.isArray(fieldType) && fieldType[0] instanceof Enum) { + enums.add(fieldType[0]); + } + } + }); + }; + + this.operations.forEach((operation) => { + collectFromFields(operation.config.args); + if (Array.isArray(operation.config.data)) { + collectFromFields(operation.config.data[0].config.fields); + } else { + collectFromFields(operation.config.data.config.fields); + } + }); + + enums.forEach((enumType) => { + enumsString += `enum ${enumType.name} {\n`; + Object.values(enumType.values).forEach((value) => { + enumsString += ` ${value}\n`; + }); + enumsString += "}\n\n"; + }); + + return enumsString; + } + + private generateOperationFields(type: "query" | "mutation"): string { + return this.operations + .filter((operation) => operation.type === type) + .map((operation) => { + const args = Object.entries(operation.config.args) + .map(([name, field]) => `${name}: ${this.generateFieldString(field)}`) + .join(", "); + const outputType = Array.isArray(operation.config.data) + ? `[${operation.config.data[0].name}]!` + : `${operation.config.data.name}!`; + return ` ${operation.name}(${args}): ${outputType}`; + }) + .join("\n"); + } + + private generateDTOs(): string { + const DTOs = new Set<{ + dtoType: "input" | "type"; + dto: DTO | DTO[]; + }>(); + let dtoString = ""; + + this.operations.forEach((operation) => { + Object.values(operation.config.args).forEach((arg) => { + if (arg.type instanceof Input) { + DTOs.add({ dtoType: "input", dto: arg.type }); + } + }); + DTOs.add({ dtoType: "type", dto: operation.config.data }); + }); + + DTOs.forEach((dto) => { + dtoString += this.generateDTOFields(dto); + }); + + return dtoString; + } + + private generateDTOFields(input: { + dtoType: "input" | "type"; + dto: DTO | DTO[]; + }): string { + const dtoInput = input.dto; + const isArray = Array.isArray(dtoInput); + const dto = isArray ? dtoInput[0] : dtoInput; + + const fieldsString = Object.entries(dto.config.fields) + .map(([fieldName, field]) => { + const fieldTypeString = this.generateFieldString(field); + return ` ${fieldName}: ${fieldTypeString}`; + }) + .join("\n"); + + return `${input.dtoType} ${dto.name} {\n${fieldsString}\n}\n\n`; + } + + private generateFieldString(field: Field): string { + const isArray = Array.isArray(field.type); + const baseType = Array.isArray(field.type) ? field.type[0] : field.type; + const typeName = baseType instanceof Type ? baseType.name : baseType.name; + return `${isArray ? `[${typeName}]` : typeName}${ + field.config.nullable ? "" : "!" + }`; + } +} diff --git a/lib/utils/helpers.ts b/lib/utils/helpers.ts index 2d22d7e8..f5eedf7b 100644 --- a/lib/utils/helpers.ts +++ b/lib/utils/helpers.ts @@ -4,7 +4,10 @@ * @param source: Headers * @returns */ -export const mergeHeaders = (base: Headers, source: Headers) => { +export const mergeHeaders = ( + base: Headers, + source: Headers = new Headers() +) => { for (const pair of source) { base.set(pair[0], pair[1]); } diff --git a/package.json b/package.json index f0561bd9..8d483128 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "peko", + "name": "@sejori/peko", "version": "2.2.0", "description": "Featherweight apps on the edge, built with Web Standards 🐣⚡", "main": "mod.ts", @@ -10,13 +10,13 @@ }, "type": "module", "scripts": { - "start": "deno run --allow-net --allow-read --allow-env scripts/deno/main.ts", + "start": "deno run --allow-net --allow-read --allow-env ----allow-run scripts/deno/main.ts", "test": "deno test --allow-read --allow-net", "profile:deno": "deno run --allow-read --allow-net scripts/deno/profile.ts", "profile:bun": "bun run scripts/bun/profile.ts", "profile:start:wrangler": "wrangler dev scripts/wrangler/testApp.ts", "profile:wrangler": "node --loader ts-node/esm scripts/wrangler/profile.ts", - "start:dev:deno": "deno run --allow-net --allow-read --allow-env --watch scripts/deno/main.ts", + "start:dev:deno": "deno run -A --watch scripts/deno/main.ts", "start:dev:bun": "bun run --watch scripts/bun/main.ts", "start:dev:wrangler": "wrangler dev scripts/wrangler/main.ts" }, diff --git a/scripts/bun/main.ts b/scripts/bun/main.ts index 955b4015..dc941187 100644 --- a/scripts/bun/main.ts +++ b/scripts/bun/main.ts @@ -1,10 +1,13 @@ import router from "../../example/preactSSR/router.ts"; +router.middleware.unshift((ctx) => { + ctx.state.env = process.env +}); + Bun.serve({ port: 8080, fetch(req) { return router.handle(req); - }, }); console.log("Bun server running with Peko router <3"); diff --git a/scripts/deno/main.ts b/scripts/deno/main.ts index d2e897e9..15be73d1 100644 --- a/scripts/deno/main.ts +++ b/scripts/deno/main.ts @@ -1,5 +1,10 @@ import router from "../../example/preactSSR/router.ts"; +router.middleware.unshift((ctx) => { + console.log("heelo"); + ctx.state.env = Deno.env.toObject(); +}); + // Start Deno server with Peko router :^) Deno.serve( { diff --git a/scripts/wrangler/main.ts b/scripts/wrangler/main.ts index 767c045b..f1aa9b5b 100644 --- a/scripts/wrangler/main.ts +++ b/scripts/wrangler/main.ts @@ -1,5 +1,9 @@ import router from "../../example/preactSSR/router.ts"; +router.middleware.unshift((ctx) => { + ctx.state.env = env; +}); + export default { fetch(request: Request) { return router.handle(request); diff --git a/tests/utils/Schema_test.ts b/tests/utils/Schema_test.ts new file mode 100644 index 00000000..bbb0e403 --- /dev/null +++ b/tests/utils/Schema_test.ts @@ -0,0 +1,159 @@ +import { assert } from "https://deno.land/std@0.218.0/assert/mod.ts"; +import { + Type, + Enum, + Field, + Int, + Input, + Schema, + Mutation, + Query, + ResolvedType, +} from "../../lib/utils/Schema.ts"; + +Deno.test("UTIL: Profiler", async (t) => { + const emailField = new Field(String, { + validator: (x) => x.includes("@") && x.includes("."), + }); + + const ageField = new Field(Int, { + nullable: true, + validator: (x) => typeof x === "number" && x > 0, + }); + + const user = new Type("User", { + fields: { + email: emailField, + age: ageField, + }, + }); + + const mockUser: ResolvedType = { + email: "test@test.com", + age: 20, + }; + + const content = new Type("Content", { + fields: { + title: new Field(String), + content: new Field(String), + }, + }); + + const mockContent: ResolvedType = { + title: "Hello", + content: "World", + }; + + enum PostStatus { + draft = "draft", + published = "published", + } + + const post = new Type("Post", { + fields: { + author: new Field(user, { + resolver: async (ctx) => [mockUser], + }), + content: new Field(content, { + resolver: async (ctx) => [mockContent], + }), + status: new Field(new Enum("PostStatus", PostStatus)), + likes: new Field([user], { + resolver: async (ctx) => [[mockUser]], + }), + }, + }); + + const mockPost: ResolvedType = { + author: mockUser, + content: mockContent, + status: PostStatus.published, + likes: [mockUser], + }; + + const comment = new Type("Comment", { + fields: { + author: new Field(user, { + resolver: async (ctx) => [mockUser], + }), + post: new Field(post, { + resolver: async (ctx) => [mockPost], + }), + text: new Field(String), + }, + }); + + const mockComment: ResolvedType = { + author: mockUser, + post: mockPost, + text: "Hello", + }; + + const registerUser = new Mutation("RegisterUser", { + args: { + email: emailField, + age: ageField, + }, + data: user, + resolver: async (ctx) => mockUser, + }); + + const createContent = new Mutation("CreateContent", { + args: { + content: new Field( + new Input("CreateContentInput", { + fields: content.config.fields, + }) + ), + }, + data: content, + resolver: async (ctx) => mockContent, + }); + + const postContent = new Mutation("PostContent", { + args: { + content: new Field( + new Input("PostContentInput", { + fields: post.config.fields, + }) + ), + }, + data: post, + resolver: async (ctx) => mockPost, + }); + + const commentOnPost = new Mutation("CommentOnPostInput", { + args: { + comment: new Field( + new Input("CommentOnPost", { + fields: comment.config.fields, + }) + ), + }, + data: comment, + resolver: async (ctx) => mockComment, + }); + + const getComments = new Query("GetComments", { + args: { + post: new Field(post), + }, + data: [comment], + resolver: async (ctx) => [mockComment], + }); + + await t.step("creates the correct schema string", async () => { + const schema = new Schema([ + registerUser, + createContent, + postContent, + commentOnPost, + getComments, + ]); + + const schemaString = schema.toString(); + console.log(schemaString); + assert(schemaString); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 20822b6e..38675615 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ "target": "esnext", "module": "esnext", "lib": ["esnext"], - "types": ["@cloudflare/workers-types"] + "types": ["@cloudflare/workers-types"], + "noEmit": true } }