From 6b6f9e535fa6ced73bfaf7598420000c7e2b59d8 Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:10:03 +0200 Subject: [PATCH 1/2] Migrating to express 5 --- pnpm-lock.yaml | 270 ++++++++++++++++++------- src/ep.json | 6 - src/node/hooks/express/admin.ts | 2 +- src/node/hooks/express/importexport.ts | 4 +- src/node/hooks/express/static.ts | 7 +- src/node/hooks/express/tests.ts | 83 -------- src/node/utils/Minify.ts | 2 +- src/package.json | 4 +- 8 files changed, 203 insertions(+), 175 deletions(-) delete mode 100644 src/node/hooks/express/tests.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9fc7e3c1ed0..ed266f4ce7d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -165,11 +165,11 @@ importers: specifier: ^0.24.0 version: 0.24.0 express: - specifier: 4.21.0 - version: 4.21.0 + specifier: ^5.0.0 + version: 5.0.0 express-rate-limit: specifier: ^7.4.0 - version: 7.4.0(express@4.21.0) + version: 7.4.0(express@5.0.0) fast-deep-equal: specifier: ^3.1.3 version: 3.1.3 @@ -259,7 +259,7 @@ importers: version: 10.1.0 swagger-ui-express: specifier: ^5.0.1 - version: 5.0.1(express@4.21.0) + version: 5.0.1(express@5.0.0) tinycon: specifier: 0.6.8 version: 0.6.8 @@ -286,8 +286,8 @@ importers: specifier: ^3.2.24 version: 3.2.24 '@types/express': - specifier: ^4.17.21 - version: 4.17.21 + specifier: ^5.0.0 + version: 5.0.0 '@types/formidable': specifier: ^3.4.5 version: 3.4.5 @@ -1646,11 +1646,11 @@ packages: '@types/estree@1.0.6': resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} - '@types/express-serve-static-core@4.19.6': - resolution: {integrity: sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A==} + '@types/express-serve-static-core@5.0.0': + resolution: {integrity: sha512-AbXMTZGt40T+KON9/Fdxx0B2WK5hsgxcfXJLr5bFpZ7b4JCex2WyQPTEKdXqfHiY5nKKBScZ7yCoO6Pvgxfvnw==} - '@types/express@4.17.21': - resolution: {integrity: sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==} + '@types/express@5.0.0': + resolution: {integrity: sha512-DvZriSMehGHL1ZNLzi6MidnsDhUZM/x2pRdDIKdwbUNqqwHxMlRdkxtn6/EPKyqKpHqTl/4nRZsRNLpZxZRpPQ==} '@types/formidable@3.4.5': resolution: {integrity: sha512-s7YPsNVfnsng5L8sKnG/Gbb2tiwwJTY1conOkJzTMRvJAlLFW1nEua+ADsJQu8N1c0oTHx9+d5nqg10WuT9gHQ==} @@ -2050,6 +2050,10 @@ packages: resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} engines: {node: '>= 0.6'} + accepts@2.0.0: + resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==} + engines: {node: '>= 0.6'} + acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -2112,8 +2116,8 @@ packages: resolution: {integrity: sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==} engines: {node: '>= 0.4'} - array-flatten@1.1.1: - resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} + array-flatten@3.0.0: + resolution: {integrity: sha512-zPMVc3ZYlGLNk4mpK1NzP2wg0ml9t7fUgDsayR5Y5rSzxQilzR9FGu/EH2jQOcKSAeAfWeylyW8juy3OkWRvNA==} array-includes@3.1.8: resolution: {integrity: sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==} @@ -2190,9 +2194,9 @@ packages: birpc@0.2.17: resolution: {integrity: sha512-+hkTxhot+dWsLpp3gia5AkVHIsKlZybNT5gIYiDlNzJrmYPcTM9k5/w2uaj3IPpd7LlEYpmCj4Jj1nC41VhDFg==} - body-parser@1.20.3: - resolution: {integrity: sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==} - engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} + body-parser@2.0.1: + resolution: {integrity: sha512-PagxbjvuPH6tv0f/kdVbFGcb79D236SLcDTs6DrQ7GizJ88S1UWP4nMXFEo/I4fdhGRGabvFfFjVGm3M7U8JwA==} + engines: {node: '>= 0.10'} brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} @@ -2331,6 +2335,10 @@ packages: resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==} engines: {node: '>= 0.6'} + content-disposition@1.0.0: + resolution: {integrity: sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==} + engines: {node: '>= 0.6'} + content-type@1.0.5: resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} engines: {node: '>= 0.6'} @@ -2345,6 +2353,10 @@ packages: cookie-signature@1.0.6: resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==} + cookie-signature@1.2.1: + resolution: {integrity: sha512-78KWk9T26NhzXtuL26cIJ8/qNHANyJ/ZYrmEXFzUmhZdjpBv+DlWlOANRTGBt48YcyslsLrj0bMLFTmXvLRCOw==} + engines: {node: '>=6.6.0'} + cookie@0.4.1: resolution: {integrity: sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==} engines: {node: '>= 0.6'} @@ -2433,6 +2445,14 @@ packages: supports-color: optional: true + debug@3.1.0: + resolution: {integrity: sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + debug@3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} peerDependencies: @@ -2450,6 +2470,15 @@ packages: supports-color: optional: true + debug@4.3.6: + resolution: {integrity: sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + debug@4.3.7: resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} engines: {node: '>=6.0'} @@ -2847,9 +2876,9 @@ packages: peerDependencies: express: 4 || 5 || ^5.0.0-beta.1 - express@4.21.0: - resolution: {integrity: sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==} - engines: {node: '>= 0.10.0'} + express@5.0.0: + resolution: {integrity: sha512-V4UkHQc+B7ldh1YC84HCXHwf60M4BOMvp9rkvTUWCK5apqDC1Esnbid4wm6nFyVuDy8XMfETsJw5lsIGBWyo0A==} + engines: {node: '>= 18'} extend@3.0.2: resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} @@ -2895,8 +2924,8 @@ packages: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} - finalhandler@1.3.1: - resolution: {integrity: sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==} + finalhandler@2.0.0: + resolution: {integrity: sha512-MX6Zo2adDViYh+GcxxB1dpO43eypOGUOL12rLCOTMQv/DfIbpSJUy4oQIIZhVZkH9e+bZWKMon0XHFEju16tkQ==} engines: {node: '>= 0.8'} find-root@1.1.0: @@ -2958,6 +2987,10 @@ packages: resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} engines: {node: '>= 0.6'} + fresh@2.0.0: + resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} + engines: {node: '>= 0.8'} + fs-extra@10.1.0: resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==} engines: {node: '>=12'} @@ -3198,6 +3231,10 @@ packages: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} + iconv-lite@0.5.2: + resolution: {integrity: sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==} + engines: {node: '>=0.10.0'} + iconv-lite@0.6.3: resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} engines: {node: '>=0.10.0'} @@ -3320,6 +3357,9 @@ packages: is-promise@1.0.1: resolution: {integrity: sha512-mjWH5XxnhMA8cFnDchr6qRP9S/kLntKuEfIYku+PaN1CnS8v+OG9O/BKpRCVRJvpIkgAZm0Pf5Is3iSSOILlcg==} + is-promise@4.0.0: + resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} + is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} @@ -3580,8 +3620,13 @@ packages: resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} engines: {node: '>= 0.6'} - merge-descriptors@1.0.3: - resolution: {integrity: sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==} + media-typer@1.1.0: + resolution: {integrity: sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==} + engines: {node: '>= 0.8'} + + merge-descriptors@2.0.0: + resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==} + engines: {node: '>=18'} merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} @@ -3614,14 +3659,17 @@ packages: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} + mime-db@1.53.0: + resolution: {integrity: sha512-oHlN/w+3MQ3rba9rqFr6V/ypF10LSkdwUysQL7GkXoTgIWeV+tcXGA852TBxH+gsh8UWoyhR1hKcoMJTuWflpg==} + engines: {node: '>= 0.6'} + mime-types@2.1.35: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} - mime@1.6.0: - resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} - engines: {node: '>=4'} - hasBin: true + mime-types@3.0.0: + resolution: {integrity: sha512-XqoSHeCGjVClAmoGFG3lVFqQFRIrTVw2OH3axRqAcfaw+gHWIfnASS92AV+Rl/mk0MupgZTRHQOjxY6YVnzK5w==} + engines: {node: '>= 0.6'} mime@2.6.0: resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} @@ -3714,6 +3762,10 @@ packages: resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} engines: {node: '>= 0.6'} + negotiator@1.0.0: + resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==} + engines: {node: '>= 0.6'} + netmask@2.0.2: resolution: {integrity: sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==} engines: {node: '>= 0.4.0'} @@ -3868,9 +3920,6 @@ packages: path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - path-to-regexp@0.1.10: - resolution: {integrity: sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==} - path-to-regexp@6.2.2: resolution: {integrity: sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==} @@ -3985,6 +4034,10 @@ packages: resolution: {integrity: sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==} engines: {node: '>= 0.8'} + raw-body@3.0.0: + resolution: {integrity: sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==} + engines: {node: '>= 0.8'} + react-dom@18.3.1: resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==} peerDependencies: @@ -4121,6 +4174,10 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + router@2.0.0: + resolution: {integrity: sha512-dIM5zVoG8xhC6rnSN8uoAgFARwTE7BQs8YwHEvK0VCmfxQXMaOuA1uiR1IPwsW7JyK5iTt7Od/TC9StasS2NPQ==} + engines: {node: '>= 0.10'} + rrweb-cssom@0.7.1: resolution: {integrity: sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==} @@ -4224,16 +4281,16 @@ packages: engines: {node: '>=10'} hasBin: true - send@0.19.0: - resolution: {integrity: sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==} - engines: {node: '>= 0.8.0'} + send@1.1.0: + resolution: {integrity: sha512-v67WcEouB5GxbTWL/4NeToqcZiAWEq90N888fczVArY8A79J0L4FD7vj5hm3eUMua5EpoQ59wa/oovY6TLvRUA==} + engines: {node: '>= 18'} serialize-javascript@6.0.2: resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} - serve-static@1.16.2: - resolution: {integrity: sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==} - engines: {node: '>= 0.8.0'} + serve-static@2.1.0: + resolution: {integrity: sha512-A3We5UfEjG8Z7VkDv6uItWw6HY2bBSBJT1KtVESn6EOoOr2jAxNhxWCLY3jDE2WcuHXByWju74ck3ZgLwL8xmA==} + engines: {node: '>= 18'} set-cookie-parser@2.7.0: resolution: {integrity: sha512-lXLOiqpkUumhRdFF3k1osNXCy9akgx/dyPZ5p8qAg9seJzXr5ZrlqZuWIMuY6ejOsVLE6flJ5/h3lsn57fQ/PQ==} @@ -4540,6 +4597,10 @@ packages: resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} engines: {node: '>= 0.6'} + type-is@2.0.0: + resolution: {integrity: sha512-gd0sGezQYCbWSbkZr75mln4YBidWUN60+devscpLF5mtRDUpiaTvKpBNrdaCvel1NdR2k6vclXybU5fBd2i+nw==} + engines: {node: '>= 0.6'} + typed-array-buffer@1.0.2: resolution: {integrity: sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==} engines: {node: '>= 0.4'} @@ -5967,7 +6028,7 @@ snapshots: '@types/cookies@0.9.0': dependencies: '@types/connect': 3.4.38 - '@types/express': 4.17.21 + '@types/express': 5.0.0 '@types/keygrip': 1.0.6 '@types/node': 22.7.4 @@ -5983,17 +6044,17 @@ snapshots: '@types/estree@1.0.6': {} - '@types/express-serve-static-core@4.19.6': + '@types/express-serve-static-core@5.0.0': dependencies: '@types/node': 22.7.4 '@types/qs': 6.9.15 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 - '@types/express@4.17.21': + '@types/express@5.0.0': dependencies: '@types/body-parser': 1.19.5 - '@types/express-serve-static-core': 4.19.6 + '@types/express-serve-static-core': 5.0.0 '@types/qs': 6.9.15 '@types/serve-static': 1.15.7 @@ -6140,7 +6201,7 @@ snapshots: '@types/swagger-ui-express@4.1.6': dependencies: - '@types/express': 4.17.21 + '@types/express': 5.0.0 '@types/serve-static': 1.15.7 '@types/tar@6.1.13': @@ -6484,6 +6545,11 @@ snapshots: mime-types: 2.1.35 negotiator: 0.6.3 + accepts@2.0.0: + dependencies: + mime-types: 3.0.0 + negotiator: 1.0.0 + acorn-jsx@5.3.2(acorn@8.12.0): dependencies: acorn: 8.12.0 @@ -6560,7 +6626,7 @@ snapshots: call-bind: 1.0.7 is-array-buffer: 3.0.4 - array-flatten@1.1.1: {} + array-flatten@3.0.0: {} array-includes@3.1.8: dependencies: @@ -6647,18 +6713,17 @@ snapshots: birpc@0.2.17: {} - body-parser@1.20.3: + body-parser@2.0.1: dependencies: bytes: 3.1.2 content-type: 1.0.5 - debug: 2.6.9 - depd: 2.0.0 + debug: 3.1.0 destroy: 1.2.0 http-errors: 2.0.0 - iconv-lite: 0.4.24 + iconv-lite: 0.5.2 on-finished: 2.4.1 qs: 6.13.0 - raw-body: 2.5.2 + raw-body: 3.0.0 type-is: 1.6.18 unpipe: 1.0.0 transitivePeerDependencies: @@ -6808,6 +6873,10 @@ snapshots: dependencies: safe-buffer: 5.2.1 + content-disposition@1.0.0: + dependencies: + safe-buffer: 5.2.1 + content-type@1.0.5: {} convert-source-map@2.0.0: {} @@ -6819,6 +6888,8 @@ snapshots: cookie-signature@1.0.6: {} + cookie-signature@1.2.1: {} + cookie@0.4.1: {} cookie@0.4.2: {} @@ -6899,6 +6970,10 @@ snapshots: dependencies: ms: 2.0.0 + debug@3.1.0: + dependencies: + ms: 2.0.0 + debug@3.2.7: dependencies: ms: 2.1.3 @@ -6909,6 +6984,10 @@ snapshots: optionalDependencies: supports-color: 8.1.1 + debug@4.3.6: + dependencies: + ms: 2.1.2 + debug@4.3.7: dependencies: ms: 2.1.3 @@ -7467,41 +7546,42 @@ snapshots: - supports-color - utf-8-validate - express-rate-limit@7.4.0(express@4.21.0): + express-rate-limit@7.4.0(express@5.0.0): dependencies: - express: 4.21.0 + express: 5.0.0 - express@4.21.0: + express@5.0.0: dependencies: - accepts: 1.3.8 - array-flatten: 1.1.1 - body-parser: 1.20.3 - content-disposition: 0.5.4 + accepts: 2.0.0 + body-parser: 2.0.1 + content-disposition: 1.0.0 content-type: 1.0.5 cookie: 0.6.0 - cookie-signature: 1.0.6 - debug: 2.6.9 + cookie-signature: 1.2.1 + debug: 4.3.6 depd: 2.0.0 encodeurl: 2.0.0 escape-html: 1.0.3 etag: 1.8.1 - finalhandler: 1.3.1 - fresh: 0.5.2 + finalhandler: 2.0.0 + fresh: 2.0.0 http-errors: 2.0.0 - merge-descriptors: 1.0.3 + merge-descriptors: 2.0.0 methods: 1.1.2 + mime-types: 3.0.0 on-finished: 2.4.1 + once: 1.4.0 parseurl: 1.3.3 - path-to-regexp: 0.1.10 proxy-addr: 2.0.7 qs: 6.13.0 range-parser: 1.2.1 + router: 2.0.0 safe-buffer: 5.2.1 - send: 0.19.0 - serve-static: 1.16.2 + send: 1.1.0 + serve-static: 2.1.0 setprototypeof: 1.2.0 statuses: 2.0.1 - type-is: 1.6.18 + type-is: 2.0.0 utils-merge: 1.0.1 vary: 1.1.2 transitivePeerDependencies: @@ -7552,10 +7632,10 @@ snapshots: dependencies: to-regex-range: 5.0.1 - finalhandler@1.3.1: + finalhandler@2.0.0: dependencies: debug: 2.6.9 - encodeurl: 2.0.0 + encodeurl: 1.0.2 escape-html: 1.0.3 on-finished: 2.4.1 parseurl: 1.3.3 @@ -7619,6 +7699,8 @@ snapshots: fresh@0.5.2: {} + fresh@2.0.0: {} + fs-extra@10.1.0: dependencies: graceful-fs: 4.2.11 @@ -7943,6 +8025,10 @@ snapshots: dependencies: safer-buffer: 2.1.2 + iconv-lite@0.5.2: + dependencies: + safer-buffer: 2.1.2 + iconv-lite@0.6.3: dependencies: safer-buffer: 2.1.2 @@ -8048,6 +8134,8 @@ snapshots: is-promise@1.0.1: {} + is-promise@4.0.0: {} + is-regex@1.1.4: dependencies: call-bind: 1.0.7 @@ -8362,7 +8450,9 @@ snapshots: media-typer@0.3.0: {} - merge-descriptors@1.0.3: {} + media-typer@1.1.0: {} + + merge-descriptors@2.0.0: {} merge2@1.4.1: {} @@ -8392,11 +8482,15 @@ snapshots: mime-db@1.52.0: {} + mime-db@1.53.0: {} + mime-types@2.1.35: dependencies: mime-db: 1.52.0 - mime@1.6.0: {} + mime-types@3.0.0: + dependencies: + mime-db: 1.53.0 mime@2.6.0: {} @@ -8480,6 +8574,8 @@ snapshots: negotiator@0.6.3: {} + negotiator@1.0.0: {} + netmask@2.0.2: {} nise@6.1.1: @@ -8671,8 +8767,6 @@ snapshots: path-parse@1.0.7: {} - path-to-regexp@0.1.10: {} - path-to-regexp@6.2.2: {} path-to-regexp@8.1.0: {} @@ -8770,6 +8864,13 @@ snapshots: iconv-lite: 0.4.24 unpipe: 1.0.0 + raw-body@3.0.0: + dependencies: + bytes: 3.1.2 + http-errors: 2.0.0 + iconv-lite: 0.6.3 + unpipe: 1.0.0 + react-dom@18.3.1(react@18.3.1): dependencies: loose-envify: 1.4.0 @@ -8918,6 +9019,16 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.21.0 fsevents: 2.3.3 + router@2.0.0: + dependencies: + array-flatten: 3.0.0 + is-promise: 4.0.0 + methods: 1.1.2 + parseurl: 1.3.3 + path-to-regexp: 8.1.0 + setprototypeof: 1.2.0 + utils-merge: 1.0.1 + rrweb-cssom@0.7.1: {} run-parallel@1.2.0: @@ -8998,17 +9109,16 @@ snapshots: semver@7.6.3: {} - send@0.19.0: + send@1.1.0: dependencies: - debug: 2.6.9 - depd: 2.0.0 + debug: 4.3.7 destroy: 1.2.0 - encodeurl: 1.0.2 + encodeurl: 2.0.0 escape-html: 1.0.3 etag: 1.8.1 fresh: 0.5.2 http-errors: 2.0.0 - mime: 1.6.0 + mime-types: 2.1.35 ms: 2.1.3 on-finished: 2.4.1 range-parser: 1.2.1 @@ -9020,12 +9130,12 @@ snapshots: dependencies: randombytes: 2.1.0 - serve-static@1.16.2: + serve-static@2.1.0: dependencies: encodeurl: 2.0.0 escape-html: 1.0.3 parseurl: 1.3.3 - send: 0.19.0 + send: 1.1.0 transitivePeerDependencies: - supports-color @@ -9284,9 +9394,9 @@ snapshots: swagger-ui-dist@5.17.14: {} - swagger-ui-express@5.0.1(express@4.21.0): + swagger-ui-express@5.0.1(express@5.0.0): dependencies: - express: 4.21.0 + express: 5.0.0 swagger-ui-dist: 5.17.14 symbol-tree@3.2.4: {} @@ -9381,6 +9491,12 @@ snapshots: media-typer: 0.3.0 mime-types: 2.1.35 + type-is@2.0.0: + dependencies: + content-type: 1.0.5 + media-typer: 1.1.0 + mime-types: 3.0.0 + typed-array-buffer@1.0.2: dependencies: call-bind: 1.0.7 diff --git a/src/ep.json b/src/ep.json index 83dfc509db8..355a9e0b0bb 100644 --- a/src/ep.json +++ b/src/ep.json @@ -96,12 +96,6 @@ "socketio": "ep_etherpad-lite/node/handler/PadMessageHandler" } }, - { - "name": "tests", - "hooks": { - "expressPreSession": "ep_etherpad-lite/node/hooks/express/tests" - } - }, { "name": "admin", "hooks": { diff --git a/src/node/hooks/express/admin.ts b/src/node/hooks/express/admin.ts index e802750f25c..fd87c1f7efb 100644 --- a/src/node/hooks/express/admin.ts +++ b/src/node/hooks/express/admin.ts @@ -22,7 +22,7 @@ exports.expressCreateServer = (hookName: string, args: ArgsExpressType, cb: Func console.error('admin template not found, skipping admin interface. You need to rebuild it in /admin with pnpm run build-copy') return cb(); } - args.app.get('/admin/*', (req: any, res: any) => { + args.app.get('/admin/:filename', (req: any, res: any) => { // parse URL const parsedUrl = url.parse(req.url); // extract URL path diff --git a/src/node/hooks/express/importexport.ts b/src/node/hooks/express/importexport.ts index 898606e4979..bc8a040706e 100644 --- a/src/node/hooks/express/importexport.ts +++ b/src/node/hooks/express/importexport.ts @@ -25,8 +25,8 @@ exports.expressCreateServer = (hookName:string, args:ArgsExpressType, cb:Functio }); // handle export requests - args.app.use('/p/:pad/:rev?/export/:type', limiter); - args.app.get('/p/:pad/:rev?/export/:type', (req:any, res:any, next:Function) => { + args.app.use('/p/:pad/:rev{.:ext}/export/:type', limiter); + args.app.get('/p/:pad/:rev{.:ext}/export/:type', (req:any, res:any, next:Function) => { (async () => { const types = ['pdf', 'doc', 'txt', 'html', 'odt', 'etherpad']; // send a 404 if we don't support this filetype diff --git a/src/node/hooks/express/static.ts b/src/node/hooks/express/static.ts index 07a7f3a21cf..f83bb382a5b 100644 --- a/src/node/hooks/express/static.ts +++ b/src/node/hooks/express/static.ts @@ -6,6 +6,7 @@ import {PartType} from "../../types/PartType"; const fs = require('fs').promises; import {minify} from '../../utils/Minify'; import path from 'node:path'; +import {ArgsExpressType} from "../../types/ArgsExpressType"; const plugins = require('../../../static/js/pluginfw/plugin_defs'); const settings = require('../../utils/Settings'); @@ -30,16 +31,16 @@ const getTar = async () => { return tar; }; -exports.expressPreSession = async (hookName:string, {app}:any) => { +exports.expressPreSession = async (hookName:string, {app}:ArgsExpressType) => { // Minify will serve static files compressed (minify enabled). It also has // file-specific hacks for ace/require-kernel/etc. - app.all('/static/:filename(*)', minify); + app.all('/static/*filename', minify); // serve plugin definitions // not very static, but served here so that client can do // require("pluginfw/static/js/plugin-definitions.js"); - app.get('/pluginfw/plugin-definitions.json', (req: any, res:any, next:Function) => { + app.get('/pluginfw/plugin-definitions.json', (_req, res) => { const clientParts = plugins.parts.filter((part: PartType) => part.client_hooks != null); const clientPlugins:MapArrayType = {}; for (const name of new Set(clientParts.map((part: PartType) => part.plugin))) { diff --git a/src/node/hooks/express/tests.ts b/src/node/hooks/express/tests.ts deleted file mode 100644 index f8a1417ef71..00000000000 --- a/src/node/hooks/express/tests.ts +++ /dev/null @@ -1,83 +0,0 @@ -'use strict'; - -import {Dirent} from "node:fs"; -import {PluginDef} from "../../types/PartType"; - -const path = require('path'); -const fsp = require('fs').promises; -const plugins = require('../../../static/js/pluginfw/plugin_defs'); -const sanitizePathname = require('../../utils/sanitizePathname'); -const settings = require('../../utils/Settings'); - -// Returns all *.js files under specDir (recursively) as relative paths to specDir, using '/' -// instead of path.sep to separate pathname components. -const findSpecs = async (specDir: string) => { - let dirents: Dirent[]; - try { - dirents = await fsp.readdir(specDir, {withFileTypes: true}); - } catch (err:any) { - if (['ENOENT', 'ENOTDIR'].includes(err.code)) return []; - throw err; - } - const specs: string[] = []; - await Promise.all(dirents.map(async (dirent) => { - if (dirent.isDirectory()) { - const subdirSpecs = await findSpecs(path.join(specDir, dirent.name)); - specs.push(...subdirSpecs.map((spec) => `${dirent.name}/${spec}`)); - return; - } - if (!dirent.name.endsWith('.js')) return; - specs.push(dirent.name); - })); - return specs; -}; - -exports.expressPreSession = async (hookName:string, {app}:any) => { - app.get('/tests/frontend/frontendTestSpecs.json', (req:any, res:any, next:Function) => { - (async () => { - const modules:string[] = []; - await Promise.all(Object.entries(plugins.plugins).map(async ([plugin, def]) => { - let {package: {path: pluginPath}} = def as PluginDef; - if (!pluginPath.endsWith(path.sep)) pluginPath += path.sep; - const specDir = `${plugin === 'ep_etherpad-lite' ? '' : 'static/'}tests/frontend/specs`; - for (const spec of await findSpecs(path.join(pluginPath, specDir))) { - if (plugin === 'ep_etherpad-lite' && !settings.enableAdminUITests && - spec.startsWith('admin')) continue; - modules.push(`${plugin}/${specDir}/${spec.replace(/\.js$/, '')}`); - } - })); - // Sort plugin tests before core tests. - modules.sort((a, b) => { - a = String(a); - b = String(b); - const aCore = a.startsWith('ep_etherpad-lite/'); - const bCore = b.startsWith('ep_etherpad-lite/'); - if (aCore === bCore) return a.localeCompare(b); - return aCore ? 1 : -1; - }); - console.debug('Sent browser the following test spec modules:', modules); - res.json(modules); - })().catch((err) => next(err || new Error(err))); - }); - - const rootTestFolder = path.join(settings.root, 'src/tests/frontend/'); - - app.get('/tests/frontend/index.html', (req:any, res:any) => { - res.redirect(['./', ...req.url.split('?').slice(1)].join('?')); - }); - - // The regexp /[\d\D]{0,}/ is equivalent to the regexp /.*/. The Express route path used here - // uses the more verbose /[\d\D]{0,}/ pattern instead of /.*/ because path-to-regexp v0.1.7 (the - // version used with Express v4.x) interprets '.' and '*' differently than regexp. - app.get('/tests/frontend/:file([\\d\\D]{0,})', (req:any, res:any, next:Function) => { - (async () => { - let file = sanitizePathname(req.params.file); - if (['', '.', './'].includes(file)) file = 'index.html'; - res.sendFile(path.join(rootTestFolder, file)); - })().catch((err) => next(err || new Error(err))); - }); - - app.get('/tests/frontend', (req:any, res:any) => { - res.redirect(['./frontend/', ...req.url.split('?').slice(1)].join('?')); - }); -}; diff --git a/src/node/utils/Minify.ts b/src/node/utils/Minify.ts index 9660c909866..dbd4b247b3a 100644 --- a/src/node/utils/Minify.ts +++ b/src/node/utils/Minify.ts @@ -146,7 +146,7 @@ const compatPaths = { * @param res the Express response */ const _minify = async (req:any, res:any) => { - let filename = req.params.filename; + let filename = req.params.filename.join('/'); try { filename = sanitizePathname(filename); } catch (err) { diff --git a/src/package.json b/src/package.json index 0c4be442b07..e9126d0f732 100644 --- a/src/package.json +++ b/src/package.json @@ -38,7 +38,7 @@ "cross-spawn": "^7.0.3", "ejs": "^3.1.10", "esbuild": "^0.24.0", - "express": "4.21.0", + "express": "^5.0.0", "express-rate-limit": "^7.4.0", "fast-deep-equal": "^3.1.3", "find-root": "1.1.0", @@ -84,7 +84,7 @@ "devDependencies": { "@playwright/test": "^1.47.2", "@types/async": "^3.2.24", - "@types/express": "^4.17.21", + "@types/express": "^5.0.0", "@types/formidable": "^3.4.5", "@types/http-errors": "^2.0.4", "@types/jquery": "^3.5.31", From c8b5dc269a43ebb5e23122dc68e525a849bafe0c Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:24:47 +0200 Subject: [PATCH 2/2] Fixed export. --- src/node/hooks/express/importexport.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node/hooks/express/importexport.ts b/src/node/hooks/express/importexport.ts index bc8a040706e..3a361d0057f 100644 --- a/src/node/hooks/express/importexport.ts +++ b/src/node/hooks/express/importexport.ts @@ -25,8 +25,8 @@ exports.expressCreateServer = (hookName:string, args:ArgsExpressType, cb:Functio }); // handle export requests - args.app.use('/p/:pad/:rev{.:ext}/export/:type', limiter); - args.app.get('/p/:pad/:rev{.:ext}/export/:type', (req:any, res:any, next:Function) => { + args.app.use('/p/:pad{/:rev}/export/:type', limiter); + args.app.get('/p/:pad{/:rev}/export/:type', (req:any, res:any, next:Function) => { (async () => { const types = ['pdf', 'doc', 'txt', 'html', 'odt', 'etherpad']; // send a 404 if we don't support this filetype