From 18833f782a7df320227cb12e531a8787161a08b9 Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Wed, 12 Oct 2022 12:27:11 +0200 Subject: [PATCH 1/6] WIP --- docs/package.json | 2 +- packages/toolpad-app/middleware.ts | 12 +- packages/toolpad-app/package.json | 2 +- yarn.lock | 225 +++++++++++++++-------------- 4 files changed, 128 insertions(+), 113 deletions(-) diff --git a/docs/package.json b/docs/package.json index 9cd199cb08a..3beedd3b0a8 100644 --- a/docs/package.json +++ b/docs/package.json @@ -60,7 +60,7 @@ "lz-string": "^1.4.4", "markdown-to-jsx": "^7.1.7", "marked": "^4.1.1", - "next": "^12.3.1", + "next": "12.2.2", "next-transpile-modules": "^9.1.0", "nprogress": "^0.2.0", "postcss": "^8.4.17", diff --git a/packages/toolpad-app/middleware.ts b/packages/toolpad-app/middleware.ts index 0bc32259b7b..f817c294a83 100644 --- a/packages/toolpad-app/middleware.ts +++ b/packages/toolpad-app/middleware.ts @@ -1,6 +1,16 @@ -import { NextRequest, NextResponse, URLPattern } from 'next/server'; +import { + NextRequest, + NextResponse, + // @ts-expect-error + // TODO: As soon as next/server exports this member: + // - remove ` as NextURLPattern` from this line + // - remove the line below with `const URLPattern = ...` + URLPattern as NextURLPattern, +} from 'next/server'; import { checkBasicAuthHeader } from './src/server/basicAuth'; +const URLPattern = NextURLPattern || (global as any).URLPattern; + const BASIC_AUTH_WHITELIST = [ // Healthcheck must always be public new URLPattern({ pathname: '/health-check' }), diff --git a/packages/toolpad-app/package.json b/packages/toolpad-app/package.json index c18b99e0cff..5a7b8a9cc22 100644 --- a/packages/toolpad-app/package.json +++ b/packages/toolpad-app/package.json @@ -78,7 +78,7 @@ "lodash-es": "^4.17.21", "mitt": "^3.0.0", "monaco-editor": "0.34.0", - "next": "12.3.1", + "next": "12.2.2", "node-fetch": "^2.6.7", "node-fetch-har": "^1.0.1", "path-to-regexp": "^6.2.1", diff --git a/yarn.lock b/yarn.lock index 1a0aa023ac3..2a13f7732fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2006,10 +2006,10 @@ "@babel/runtime" "^7.18.9" "@mui/utils" "^5.9.3" -"@next/env@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/env/-/env-12.3.1.tgz#18266bd92de3b4aa4037b1927aa59e6f11879260" - integrity sha512-9P9THmRFVKGKt9DYqeC2aKIxm8rlvkK38V1P1sRE7qyoPBIs8l9oo79QoSdPtOWfzkbDAVUqvbQGgTMsb8BtJg== +"@next/env@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/env/-/env-12.2.2.tgz#cc1a0a445bd254499e30f632968c03192455f4cc" + integrity sha512-BqDwE4gDl1F608TpnNxZqrCn6g48MBjvmWFEmeX5wEXDXh3IkAOw6ASKUgjT8H4OUePYFqghDFUss5ZhnbOUjw== "@next/eslint-plugin-next@12.3.1": version "12.3.1" @@ -2018,70 +2018,70 @@ dependencies: glob "7.1.7" -"@next/swc-android-arm-eabi@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.1.tgz#b15ce8ad376102a3b8c0f3c017dde050a22bb1a3" - integrity sha512-i+BvKA8tB//srVPPQxIQN5lvfROcfv4OB23/L1nXznP+N/TyKL8lql3l7oo2LNhnH66zWhfoemg3Q4VJZSruzQ== - -"@next/swc-android-arm64@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-12.3.1.tgz#85d205f568a790a137cb3c3f720d961a2436ac9c" - integrity sha512-CmgU2ZNyBP0rkugOOqLnjl3+eRpXBzB/I2sjwcGZ7/Z6RcUJXK5Evz+N0ucOxqE4cZ3gkTeXtSzRrMK2mGYV8Q== - -"@next/swc-darwin-arm64@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.1.tgz#b105457d6760a7916b27e46c97cb1a40547114ae" - integrity sha512-hT/EBGNcu0ITiuWDYU9ur57Oa4LybD5DOQp4f22T6zLfpoBMfBibPtR8XktXmOyFHrL/6FC2p9ojdLZhWhvBHg== - -"@next/swc-darwin-x64@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-12.3.1.tgz#6947b39082271378896b095b6696a7791c6e32b1" - integrity sha512-9S6EVueCVCyGf2vuiLiGEHZCJcPAxglyckTZcEwLdJwozLqN0gtS0Eq0bQlGS3dH49Py/rQYpZ3KVWZ9BUf/WA== - -"@next/swc-freebsd-x64@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.1.tgz#2b6c36a4d84aae8b0ea0e0da9bafc696ae27085a" - integrity sha512-qcuUQkaBZWqzM0F1N4AkAh88lLzzpfE6ImOcI1P6YeyJSsBmpBIV8o70zV+Wxpc26yV9vpzb+e5gCyxNjKJg5Q== - -"@next/swc-linux-arm-gnueabihf@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.1.tgz#6e421c44285cfedac1f4631d5de330dd60b86298" - integrity sha512-diL9MSYrEI5nY2wc/h/DBewEDUzr/DqBjIgHJ3RUNtETAOB3spMNHvJk2XKUDjnQuluLmFMloet9tpEqU2TT9w== - -"@next/swc-linux-arm64-gnu@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.1.tgz#8863f08a81f422f910af126159d2cbb9552ef717" - integrity sha512-o/xB2nztoaC7jnXU3Q36vGgOolJpsGG8ETNjxM1VAPxRwM7FyGCPHOMk1XavG88QZSQf+1r+POBW0tLxQOJ9DQ== - -"@next/swc-linux-arm64-musl@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.1.tgz#0038f07cf0b259d70ae0c80890d826dfc775d9f3" - integrity sha512-2WEasRxJzgAmP43glFNhADpe8zB7kJofhEAVNbDJZANp+H4+wq+/cW1CdDi8DqjkShPEA6/ejJw+xnEyDID2jg== - -"@next/swc-linux-x64-gnu@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.1.tgz#c66468f5e8181ffb096c537f0dbfb589baa6a9c1" - integrity sha512-JWEaMyvNrXuM3dyy9Pp5cFPuSSvG82+yABqsWugjWlvfmnlnx9HOQZY23bFq3cNghy5V/t0iPb6cffzRWylgsA== - -"@next/swc-linux-x64-musl@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.1.tgz#c6269f3e96ac0395bc722ad97ce410ea5101d305" - integrity sha512-xoEWQQ71waWc4BZcOjmatuvPUXKTv6MbIFzpm4LFeCHsg2iwai0ILmNXf81rJR+L1Wb9ifEke2sQpZSPNz1Iyg== - -"@next/swc-win32-arm64-msvc@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.1.tgz#83c639ee969cee36ce247c3abd1d9df97b5ecade" - integrity sha512-hswVFYQYIeGHE2JYaBVtvqmBQ1CppplQbZJS/JgrVI3x2CurNhEkmds/yqvDONfwfbttTtH4+q9Dzf/WVl3Opw== - -"@next/swc-win32-ia32-msvc@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.1.tgz#52995748b92aa8ad053440301bc2c0d9fbcf27c2" - integrity sha512-Kny5JBehkTbKPmqulr5i+iKntO5YMP+bVM8Hf8UAmjSMVo3wehyLVc9IZkNmcbxi+vwETnQvJaT5ynYBkJ9dWA== - -"@next/swc-win32-x64-msvc@12.3.1": - version "12.3.1" - resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.1.tgz#27d71a95247a9eaee03d47adee7e3bd594514136" - integrity sha512-W1ijvzzg+kPEX6LAc+50EYYSEo0FVu7dmTE+t+DM4iOLqgGHoW9uYSz9wCVdkXOEEMP9xhXfGpcSxsfDucyPkA== +"@next/swc-android-arm-eabi@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.2.2.tgz#f6c4111e6371f73af6bf80c9accb3d96850a92cd" + integrity sha512-VHjuCHeq9qCprUZbsRxxM/VqSW8MmsUtqB5nEpGEgUNnQi/BTm/2aK8tl7R4D0twGKRh6g1AAeFuWtXzk9Z/vQ== + +"@next/swc-android-arm64@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-12.2.2.tgz#b69de59c51e631a7600439e7a8993d6e82f3369e" + integrity sha512-v5EYzXUOSv0r9mO/2PX6mOcF53k8ndlu9yeFHVAWW1Dhw2jaJcvTRcCAwYYN8Q3tDg0nH3NbEltJDLKmcJOuVA== + +"@next/swc-darwin-arm64@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.2.2.tgz#80157c91668eff95b72d052428c353eab0fc4c50" + integrity sha512-JCoGySHKGt+YBk7xRTFGx1QjrnCcwYxIo3yGepcOq64MoiocTM3yllQWeOAJU2/k9MH0+B5E9WUSme4rOCBbpA== + +"@next/swc-darwin-x64@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-12.2.2.tgz#12be2f58e676fccff3d48a62921b9927ed295133" + integrity sha512-dztDtvfkhUqiqpXvrWVccfGhLe44yQ5tQ7B4tBfnsOR6vxzI9DNPHTlEOgRN9qDqTAcFyPxvg86mn4l8bB9Jcw== + +"@next/swc-freebsd-x64@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.2.2.tgz#de1363431a49059f1efb8c0f86ce6a79c53b3a95" + integrity sha512-JUnXB+2xfxqsAvhFLPJpU1NeyDsvJrKoOjpV7g3Dxbno2Riu4tDKn3kKF886yleAuD/1qNTUCpqubTvbbT2VoA== + +"@next/swc-linux-arm-gnueabihf@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.2.2.tgz#d5b8e0d1bb55bbd9db4d2fec018217471dc8b9e6" + integrity sha512-XeYC/qqPLz58R4pjkb+x8sUUxuGLnx9QruC7/IGkK68yW4G17PHwKI/1njFYVfXTXUukpWjcfBuauWwxp9ke7Q== + +"@next/swc-linux-arm64-gnu@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.2.2.tgz#3bc75984e1d5ec8f59eb53702cc382d8e1be2061" + integrity sha512-d6jT8xgfKYFkzR7J0OHo2D+kFvY/6W8qEo6/hmdrTt6AKAqxs//rbbcdoyn3YQq1x6FVUUd39zzpezZntg9Naw== + +"@next/swc-linux-arm64-musl@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.2.2.tgz#270db73e07a18d999f61e79a917943fa5bc1ef56" + integrity sha512-rIZRFxI9N/502auJT1i7coas0HTHUM+HaXMyJiCpnY8Rimbo0495ir24tzzHo3nQqJwcflcPTwEh/DV17sdv9A== + +"@next/swc-linux-x64-gnu@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.2.2.tgz#e6c72fa20478552e898c434f4d4c0c5e89d2ea78" + integrity sha512-ir1vNadlUDj7eQk15AvfhG5BjVizuCHks9uZwBfUgT5jyeDCeRvaDCo1+Q6+0CLOAnYDR/nqSCvBgzG2UdFh9A== + +"@next/swc-linux-x64-musl@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.2.2.tgz#b9ef9efe2c401839cdefa5e70402386aafdce15a" + integrity sha512-bte5n2GzLN3O8JdSFYWZzMgEgDHZmRz5wiispiiDssj4ik3l8E7wq/czNi8RmIF+ioj2sYVokUNa/ekLzrESWw== + +"@next/swc-win32-arm64-msvc@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.2.2.tgz#18fa7ec7248da3a7926a0601d9ececc53ac83157" + integrity sha512-ZUGCmcDmdPVSAlwJ/aD+1F9lYW8vttseiv4n2+VCDv5JloxiX9aY32kYZaJJO7hmTLNrprvXkb4OvNuHdN22Jg== + +"@next/swc-win32-ia32-msvc@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.2.2.tgz#54936e84f4a219441d051940354da7cd3eafbb4f" + integrity sha512-v7ykeEDbr9eXiblGSZiEYYkWoig6sRhAbLKHUHQtk8vEWWVEqeXFcxmw6LRrKu5rCN1DY357UlYWToCGPQPCRA== + +"@next/swc-win32-x64-msvc@12.2.2": + version "12.2.2" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.2.2.tgz#7460be700a60d75816f01109400b51fe929d7e89" + integrity sha512-2D2iinWUL6xx8D9LYVZ5qi7FP6uLAoWymt8m8aaG2Ld/Ka8/k723fJfiklfuAcwOxfufPJI+nRbT5VcgHGzHAQ== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -2577,10 +2577,10 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@swc/helpers@0.4.11": - version "0.4.11" - resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.4.11.tgz#db23a376761b3d31c26502122f349a21b592c8de" - integrity sha512-rEUrBSGIoSFuYxwBYtlUFMlE2CwGhmW+w9355/5oduSw8e5h2+Tj4UrAGNNgP9915++wj5vkQo0UuOBqOAq4nw== +"@swc/helpers@0.4.2": + version "0.4.2" + resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.4.2.tgz#ed1f6997ffbc22396665d9ba74e2a5c0a2d782f8" + integrity sha512-556Az0VX7WR6UdoTn4htt/l3zPQ7bsQWK+HqdG4swV7beUCxo/BqmvbOpUkTIm/9ih86LIf1qsUnywNL3obGHw== dependencies: tslib "^2.4.0" @@ -4259,7 +4259,7 @@ camelize@^1.0.0: resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b" integrity sha512-W2lPwkBkMZwFlPCXhIlYgxu+7gC/NUlCtdK652DAJ1JdgV0sTrvuPFshNPrFa1TY2JOkLhgdeEBplB4ezEa+xg== -caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001407: +caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001407: version "1.0.30001418" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001418.tgz#5f459215192a024c99e3e3a53aac310fc7cf24e6" integrity sha512-oIs7+JL3K9JRQ3jPZjlH6qyYDp+nBTCais7hjh0s+fuBwufc7uZ7hPYMXrDOJhV360KGMTcczMRObk0/iMqZRg== @@ -8909,7 +8909,7 @@ nanoid@^2.0.3: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-2.1.11.tgz#ec24b8a758d591561531b4176a01e3ab4f0f0280" integrity sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA== -nanoid@^3.3.4: +nanoid@^3.1.30, nanoid@^3.3.4: version "3.3.4" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== @@ -8942,31 +8942,31 @@ next-transpile-modules@^9.1.0: enhanced-resolve "^5.10.0" escalade "^3.1.1" -next@12.3.1, next@^12.3.1: - version "12.3.1" - resolved "https://registry.yarnpkg.com/next/-/next-12.3.1.tgz#127b825ad2207faf869b33393ec8c75fe61e50f1" - integrity sha512-l7bvmSeIwX5lp07WtIiP9u2ytZMv7jIeB8iacR28PuUEFG5j0HGAPnMqyG5kbZNBG2H7tRsrQ4HCjuMOPnANZw== - dependencies: - "@next/env" "12.3.1" - "@swc/helpers" "0.4.11" - caniuse-lite "^1.0.30001406" - postcss "8.4.14" - styled-jsx "5.0.7" - use-sync-external-store "1.2.0" +next@12.2.2: + version "12.2.2" + resolved "https://registry.yarnpkg.com/next/-/next-12.2.2.tgz#029bf5e4a18a891ca5d05b189b7cd983fd22c072" + integrity sha512-zAYFY45aBry/PlKONqtlloRFqU/We3zWYdn2NoGvDZkoYUYQSJC8WMcalS5C19MxbCZLUVCX7D7a6gTGgl2yLg== + dependencies: + "@next/env" "12.2.2" + "@swc/helpers" "0.4.2" + caniuse-lite "^1.0.30001332" + postcss "8.4.5" + styled-jsx "5.0.2" + use-sync-external-store "1.1.0" optionalDependencies: - "@next/swc-android-arm-eabi" "12.3.1" - "@next/swc-android-arm64" "12.3.1" - "@next/swc-darwin-arm64" "12.3.1" - "@next/swc-darwin-x64" "12.3.1" - "@next/swc-freebsd-x64" "12.3.1" - "@next/swc-linux-arm-gnueabihf" "12.3.1" - "@next/swc-linux-arm64-gnu" "12.3.1" - "@next/swc-linux-arm64-musl" "12.3.1" - "@next/swc-linux-x64-gnu" "12.3.1" - "@next/swc-linux-x64-musl" "12.3.1" - "@next/swc-win32-arm64-msvc" "12.3.1" - "@next/swc-win32-ia32-msvc" "12.3.1" - "@next/swc-win32-x64-msvc" "12.3.1" + "@next/swc-android-arm-eabi" "12.2.2" + "@next/swc-android-arm64" "12.2.2" + "@next/swc-darwin-arm64" "12.2.2" + "@next/swc-darwin-x64" "12.2.2" + "@next/swc-freebsd-x64" "12.2.2" + "@next/swc-linux-arm-gnueabihf" "12.2.2" + "@next/swc-linux-arm64-gnu" "12.2.2" + "@next/swc-linux-arm64-musl" "12.2.2" + "@next/swc-linux-x64-gnu" "12.2.2" + "@next/swc-linux-x64-musl" "12.2.2" + "@next/swc-win32-arm64-msvc" "12.2.2" + "@next/swc-win32-ia32-msvc" "12.2.2" + "@next/swc-win32-x64-msvc" "12.2.2" node-addon-api@^3.2.1: version "3.2.1" @@ -9857,14 +9857,14 @@ postcss-value-parser@^4.0.2, postcss-value-parser@^4.2.0: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== -postcss@8.4.14: - version "8.4.14" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf" - integrity sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig== +postcss@8.4.5: + version "8.4.5" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.5.tgz#bae665764dfd4c6fcc24dc0fdf7e7aa00cc77f95" + integrity sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg== dependencies: - nanoid "^3.3.4" + nanoid "^3.1.30" picocolors "^1.0.0" - source-map-js "^1.0.2" + source-map-js "^1.0.1" postcss@^8.4.17: version "8.4.17" @@ -10851,7 +10851,7 @@ source-map-js@^0.6.2: resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-0.6.2.tgz#0bb5de631b41cfbda6cfba8bd05a80efdfd2385e" integrity sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug== -source-map-js@^1.0.2: +source-map-js@^1.0.1, source-map-js@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== @@ -11181,10 +11181,10 @@ styled-components@^5.3.6: shallowequal "^1.1.0" supports-color "^5.5.0" -styled-jsx@5.0.7: - version "5.0.7" - resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.0.7.tgz#be44afc53771b983769ac654d355ca8d019dff48" - integrity sha512-b3sUzamS086YLRuvnaDigdAewz1/EFYlHpYBP5mZovKEdQQOIIYq8lApylub3HHZ6xFjV051kkGU7cudJmrXEA== +styled-jsx@5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.0.2.tgz#ff230fd593b737e9e68b630a694d460425478729" + integrity sha512-LqPQrbBh3egD57NBcHET4qcgshPks+yblyhPlH2GY8oaDgKs8SK4C3dBh3oSJjgzJ3G5t1SYEZGHkP+QEpX9EQ== "stylis-plugin-rtl-sc@npm:stylis-plugin-rtl@^2.1.1", stylis-plugin-rtl@^2.1.1: version "2.1.1" @@ -11735,7 +11735,12 @@ url-template@^2.0.8: resolved "https://registry.yarnpkg.com/url-template/-/url-template-2.0.8.tgz#fc565a3cccbff7730c775f5641f9555791439f21" integrity sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw== -use-sync-external-store@1.2.0, use-sync-external-store@^1.2.0: +use-sync-external-store@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.1.0.tgz#3343c3fe7f7e404db70f8c687adf5c1652d34e82" + integrity sha512-SEnieB2FPKEVne66NpXPd1Np4R1lTNKfjuy3XdIoPQKYBAFdzbzSZlSn1KJZUiihQLQC5Znot4SBz1EOTBwQAQ== + +use-sync-external-store@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== From 82289e611e509ddec8589c9df39c6f31ba847567 Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Wed, 12 Oct 2022 15:58:05 +0200 Subject: [PATCH 2/6] test --- test/integration/large-dom/index.spec.ts | 12 +++++++ test/integration/large-dom/large.json | 43 ++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 test/integration/large-dom/index.spec.ts create mode 100644 test/integration/large-dom/large.json diff --git a/test/integration/large-dom/index.spec.ts b/test/integration/large-dom/index.spec.ts new file mode 100644 index 00000000000..7f84e73ab59 --- /dev/null +++ b/test/integration/large-dom/index.spec.ts @@ -0,0 +1,12 @@ +import * as path from 'path'; +import { test } from '@playwright/test'; +import { ToolpadHome } from '../../models/ToolpadHome'; +import { readJsonFile } from '../../utils/fs'; + +test.only('large dom', async ({ page }) => { + const dom = await readJsonFile(path.resolve(__dirname, './large.json')); + + const homeModel = new ToolpadHome(page); + await homeModel.goto(); + await homeModel.createApplication({ dom }); +}); diff --git a/test/integration/large-dom/large.json b/test/integration/large-dom/large.json new file mode 100644 index 00000000000..6ca1c80c03f --- /dev/null +++ b/test/integration/large-dom/large.json @@ -0,0 +1,43 @@ +{ + "root": "zu0ddkw", + "nodes": { + "zu0ddkw": { + "id": "zu0ddkw", + "name": "Application", + "type": "app", + "parentId": null, + "attributes": {}, + "parentProp": null, + "parentIndex": null + }, + "zv1dddx": { + "id": "zv1dddx", + "name": "page1", + "type": "page", + "parentId": "zu0ddkw", + "attributes": { + "title": { + "type": "const", + "value": "Page 1" + } + }, + "parentProp": "pages", + "parentIndex": "a0" + }, + "gp030w9": { + "name": "myComponent", + "attributes": { + "code": { + "type": "const", + "value": "import * as React from \"react\";\nimport { styled } from \"@mui/material/styles\";\nimport Card from \"@mui/material/Card\";\nimport CardHeader from \"@mui/material/CardHeader\";\nimport CardMedia from \"@mui/material/CardMedia\";\nimport CardContent from \"@mui/material/CardContent\";\nimport CardActions from \"@mui/material/CardActions\";\nimport Collapse from \"@mui/material/Collapse\";\nimport Avatar from \"@mui/material/Avatar\";\nimport IconButton, { IconButtonProps } from \"@mui/material/IconButton\";\nimport Typography from \"@mui/material/Typography\";\nimport { red } from \"@mui/material/colors\";\nimport FavoriteIcon from \"@mui/icons-material/Favorite\";\nimport ShareIcon from \"@mui/icons-material/Share\";\nimport ExpandMoreIcon from \"@mui/icons-material/ExpandMore\";\nimport MoreVertIcon from \"@mui/icons-material/MoreVert\";\n\nimport { createComponent } from \"@mui/toolpad-core\";\n\ninterface ExpandMoreProps extends IconButtonProps {\n expand: boolean;\n}\n\nconst ExpandMore = styled((props: ExpandMoreProps) => {\n const { expand, ...other } = props;\n return ;\n})(({ theme, expand }) => ({\n transform: !expand ? \"rotate(0deg)\" : \"rotate(180deg)\",\n marginLeft: \"auto\",\n transition: theme.transitions.create(\"transform\", {\n duration: theme.transitions.duration.shortest,\n }),\n}));\n\nfunction RecipeReviewCard() {\n const [expanded, setExpanded] = React.useState(false);\n\n const handleExpandClick = () => {\n setExpanded(!expanded);\n };\n\n return (\n \n \n R\n \n }\n action={\n \n \n \n }\n title=\"Shrimp and Chorizo Paella\"\n subheader=\"September 14, 2016\"\n />\n \n \n \n This impressive paella is a perfect party dish and a fun meal to cook\n together with your guests. Add 1 cup of frozen peas along with the\n mussels, if you like.\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Method:\n \n Heat 1/2 cup of the broth in a pot until simmering, add saffron and\n set aside for 10 minutes.\n \n \n Heat oil in a (14- to 16-inch) paella pan or a large, deep skillet\n over medium-high heat. Add chicken, shrimp and chorizo, and cook,\n stirring occasionally until lightly browned, 6 to 8 minutes.\n Transfer shrimp to a large plate and set aside, leaving chicken and\n chorizo in the pan. Add pimentón, bay leaves, garlic, tomatoes,\n onion, salt and pepper, and cook, stirring often until thickened and\n fragrant, about 10 minutes. Add saffron broth and remaining 4 1/2\n cups chicken broth; bring to a boil.\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Add rice and stir very gently to distribute. Top with artichokes and\n peppers, and cook without stirring, until most of the liquid is\n absorbed, 15 to 18 minutes. Reduce heat to medium-low, add reserved\n shrimp and mussels, tucking them down into the rice, and cook again\n without stirring, until mussels have opened and rice is just tender,\n 5 to 7 minutes more. (Discard any mussels that don't open.)\n \n \n Set aside off of the heat to let rest for 10 minutes, and then\n serve.\n \n \n \n \n );\n}\n\nexport default createComponent(RecipeReviewCard);\n" + } + }, + "id": "gp030w9", + "type": "codeComponent", + "parentId": "zu0ddkw", + "parentProp": "codeComponents", + "parentIndex": "a0" + } + }, + "version": 2 +} From 6c2335d1bb6182eac14472a06252f25122bf565f Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Wed, 12 Oct 2022 15:58:21 +0200 Subject: [PATCH 3/6] only --- test/integration/large-dom/index.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/large-dom/index.spec.ts b/test/integration/large-dom/index.spec.ts index 7f84e73ab59..3661a6b6bf1 100644 --- a/test/integration/large-dom/index.spec.ts +++ b/test/integration/large-dom/index.spec.ts @@ -3,7 +3,7 @@ import { test } from '@playwright/test'; import { ToolpadHome } from '../../models/ToolpadHome'; import { readJsonFile } from '../../utils/fs'; -test.only('large dom', async ({ page }) => { +test('large dom', async ({ page }) => { const dom = await readJsonFile(path.resolve(__dirname, './large.json')); const homeModel = new ToolpadHome(page); From f071eab9f4fceb723c4ddca0cc15020c6ad8a3bc Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Wed, 12 Oct 2022 16:16:06 +0200 Subject: [PATCH 4/6] AbortDignal polyfill --- .../toolpad-app/src/server/getLatestRelease.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/toolpad-app/src/server/getLatestRelease.ts b/packages/toolpad-app/src/server/getLatestRelease.ts index bf802a09acb..608fc3e0099 100644 --- a/packages/toolpad-app/src/server/getLatestRelease.ts +++ b/packages/toolpad-app/src/server/getLatestRelease.ts @@ -5,11 +5,23 @@ interface GithubRelease { url: string; } +function abortSignalTimeout(ms: number): AbortSignal { + // @ts-expect-error See https://github.com/microsoft/TypeScript/issues/48003 + if (AbortSignal.timeout) { + console.warn('Next.js support AbortSignal.timeout, remove this polyfill'); + // @ts-expect-error See https://github.com/microsoft/TypeScript/issues/48003 + return AbortSignal.timeout(ms); + } + + const controller = new AbortController(); + setTimeout(() => controller.abort(), ms); + return controller.signal; +} + async function fetchRelease(): Promise { const response = await fetch(LATEST_RELEASE_API_URL, { // Abort the request after 30 seconds - // @ts-expect-error See https://github.com/microsoft/TypeScript/issues/48003 - signal: AbortSignal.timeout(30_000), + signal: abortSignalTimeout(30_000), }); if (response.ok) { From 105fd6c79d8d9d007dc59f25e73574a5eec16344 Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Wed, 12 Oct 2022 16:43:32 +0200 Subject: [PATCH 5/6] renovatebot --- renovate.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/renovate.json b/renovate.json index 02bd93b6ba0..4f77f828160 100644 --- a/renovate.json +++ b/renovate.json @@ -68,6 +68,11 @@ "groupName": "core-js", "matchPackageNames": ["core-js"], "allowedVersions": "< 2.0.0" + }, + { + "groupName": "next", + "matchPackageNames": ["next"], + "allowedVersions": "1.2.2" } ], "postUpdateOptions": ["yarnDedupeHighest"], From 1bff2f5ee829e399d2a4a5b6271f180f2c6a0a5e Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Wed, 12 Oct 2022 17:25:04 +0200 Subject: [PATCH 6/6] try this --- packages/toolpad-app/jest-environment-jsdom.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/toolpad-app/jest-environment-jsdom.ts b/packages/toolpad-app/jest-environment-jsdom.ts index 6628fe0eb71..28319eb61da 100644 --- a/packages/toolpad-app/jest-environment-jsdom.ts +++ b/packages/toolpad-app/jest-environment-jsdom.ts @@ -1,13 +1,13 @@ import { TextDecoder, TextEncoder } from 'util'; import fetch, { Headers, Request, Response } from 'node-fetch'; - -const JsdomEnvironment = require('jest-environment-jsdom').default; +import JsdomEnvironment from 'jest-environment-jsdom'; export default class CustomJsdomEnvironment extends JsdomEnvironment { async setup() { await super.setup(); if (!this.global.TextDecoder) { + // @ts-expect-error The polyfill is not 100% spec-compliant this.global.TextDecoder = TextDecoder; } else { throw new Error(`Unnecessary polyfill "TextDecoder"`); @@ -20,9 +20,13 @@ export default class CustomJsdomEnvironment extends JsdomEnvironment { } if (!this.global.fetch) { + // @ts-expect-error The polyfill is not 100% spec-compliant this.global.fetch = fetch; + // @ts-expect-error The polyfill is not 100% spec-compliant this.global.Headers = Headers; + // @ts-expect-error The polyfill is not 100% spec-compliant this.global.Request = Request; + // @ts-expect-error The polyfill is not 100% spec-compliant this.global.Response = Response; } else { throw new Error(`Unnecessary polyfill "fetch"`);