From d832f2941dcf02b98ddaa2035a2f595b269e3bcf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:09:02 +0100 Subject: [PATCH 01/67] Bump next from 14.2.15 to 14.2.21 (#961) Bumps [next](https://github.com/vercel/next.js) from 14.2.15 to 14.2.21. - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v14.2.15...v14.2.21) --- updated-dependencies: - dependency-name: next dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 176 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 89 insertions(+), 89 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0e7d2e195..0de239d96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "highlight.js": "^11.9.0", "highlightjs-rescript": "^0.2.2", "lz-string": "^1.4.4", - "next": "^14.2.15", + "next": "^14.2.21", "next-mdx-remote": "^4.4.1", "prettier": "^1.18.2", "react": "^18.2.0", @@ -1607,9 +1607,9 @@ } }, "node_modules/@next/env": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.15.tgz", - "integrity": "sha512-S1qaj25Wru2dUpcIZMjxeMVSwkt8BK4dmWHHiBuRstcIyOsMapqT4A4jSB6onvqeygkSSmOkyny9VVx8JIGamQ==" + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.21.tgz", + "integrity": "sha512-lXcwcJd5oR01tggjWJ6SrNNYFGuOOMB9c251wUNkjCpkoXOPkDeF/15c3mnVlBqrW4JJXb2kVxDFhC4GduJt2A==" }, "node_modules/@next/eslint-plugin-next": { "version": "13.4.12", @@ -1639,9 +1639,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.15.tgz", - "integrity": "sha512-Rvh7KU9hOUBnZ9TJ28n2Oa7dD9cvDBKua9IKx7cfQQ0GoYUwg9ig31O2oMwH3wm+pE3IkAQ67ZobPfEgurPZIA==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.21.tgz", + "integrity": "sha512-HwEjcKsXtvszXz5q5Z7wCtrHeTTDSTgAbocz45PHMUjU3fBYInfvhR+ZhavDRUYLonm53aHZbB09QtJVJj8T7g==", "cpu": [ "arm64" ], @@ -1654,9 +1654,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.15.tgz", - "integrity": "sha512-5TGyjFcf8ampZP3e+FyCax5zFVHi+Oe7sZyaKOngsqyaNEpOgkKB3sqmymkZfowy3ufGA/tUgDPPxpQx931lHg==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.21.tgz", + "integrity": "sha512-TSAA2ROgNzm4FhKbTbyJOBrsREOMVdDIltZ6aZiKvCi/v0UwFmwigBGeqXDA97TFMpR3LNNpw52CbVelkoQBxA==", "cpu": [ "x64" ], @@ -1669,9 +1669,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.15.tgz", - "integrity": "sha512-3Bwv4oc08ONiQ3FiOLKT72Q+ndEMyLNsc/D3qnLMbtUYTQAmkx9E/JRu0DBpHxNddBmNT5hxz1mYBphJ3mfrrw==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.21.tgz", + "integrity": "sha512-0Dqjn0pEUz3JG+AImpnMMW/m8hRtl1GQCNbO66V1yp6RswSTiKmnHf3pTX6xMdJYSemf3O4Q9ykiL0jymu0TuA==", "cpu": [ "arm64" ], @@ -1684,9 +1684,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.15.tgz", - "integrity": "sha512-k5xf/tg1FBv/M4CMd8S+JL3uV9BnnRmoe7F+GWC3DxkTCD9aewFRH1s5rJ1zkzDa+Do4zyN8qD0N8c84Hu96FQ==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.21.tgz", + "integrity": "sha512-Ggfw5qnMXldscVntwnjfaQs5GbBbjioV4B4loP+bjqNEb42fzZlAaK+ldL0jm2CTJga9LynBMhekNfV8W4+HBw==", "cpu": [ "arm64" ], @@ -1699,9 +1699,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.15.tgz", - "integrity": "sha512-kE6q38hbrRbKEkkVn62reLXhThLRh6/TvgSP56GkFNhU22TbIrQDEMrO7j0IcQHcew2wfykq8lZyHFabz0oBrA==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.21.tgz", + "integrity": "sha512-uokj0lubN1WoSa5KKdThVPRffGyiWlm/vCc/cMkWOQHw69Qt0X1o3b2PyLLx8ANqlefILZh1EdfLRz9gVpG6tg==", "cpu": [ "x64" ], @@ -1714,9 +1714,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.15.tgz", - "integrity": "sha512-PZ5YE9ouy/IdO7QVJeIcyLn/Rc4ml9M2G4y3kCM9MNf1YKvFY4heg3pVa/jQbMro+tP6yc4G2o9LjAz1zxD7tQ==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.21.tgz", + "integrity": "sha512-iAEBPzWNbciah4+0yI4s7Pce6BIoxTQ0AGCkxn/UBuzJFkYyJt71MadYQkjPqCQCJAFQ26sYh7MOKdU+VQFgPg==", "cpu": [ "x64" ], @@ -1729,9 +1729,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.15.tgz", - "integrity": "sha512-2raR16703kBvYEQD9HNLyb0/394yfqzmIeyp2nDzcPV4yPjqNUG3ohX6jX00WryXz6s1FXpVhsCo3i+g4RUX+g==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.21.tgz", + "integrity": "sha512-plykgB3vL2hB4Z32W3ktsfqyuyGAPxqwiyrAi2Mr8LlEUhNn9VgkiAl5hODSBpzIfWweX3er1f5uNpGDygfQVQ==", "cpu": [ "arm64" ], @@ -1744,9 +1744,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.15.tgz", - "integrity": "sha512-fyTE8cklgkyR1p03kJa5zXEaZ9El+kDNM5A+66+8evQS5e/6v0Gk28LqA0Jet8gKSOyP+OTm/tJHzMlGdQerdQ==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.21.tgz", + "integrity": "sha512-w5bacz4Vxqrh06BjWgua3Yf7EMDb8iMcVhNrNx8KnJXt8t+Uu0Zg4JHLDL/T7DkTCEEfKXO/Er1fcfWxn2xfPA==", "cpu": [ "ia32" ], @@ -1759,9 +1759,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.15.tgz", - "integrity": "sha512-SzqGbsLsP9OwKNUG9nekShTwhj6JSB9ZLMWQ8g1gG6hdE5gQLncbnbymrwy2yVmH9nikSLYRYxYMFu78Ggp7/g==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.21.tgz", + "integrity": "sha512-sT6+llIkzpsexGYZq8cjjthRyRGe5cJVhqh12FmlbxHqna6zsDDK8UNaV7g41T6atFHCJUPeLb3uyAwrBwy0NA==", "cpu": [ "x64" ], @@ -9378,11 +9378,11 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, "node_modules/next": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/next/-/next-14.2.15.tgz", - "integrity": "sha512-h9ctmOokpoDphRvMGnwOJAedT6zKhwqyZML9mDtspgf4Rh3Pn7UTYKqePNoDvhsWBAO5GoPNYshnAUGIazVGmw==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/next/-/next-14.2.21.tgz", + "integrity": "sha512-rZmLwucLHr3/zfDMYbJXbw0ZeoBpirxkXuvsJbk7UPorvPYZhP7vq7aHbKnU7dQNCYIimRrbB2pp3xmf+wsYUg==", "dependencies": { - "@next/env": "14.2.15", + "@next/env": "14.2.21", "@swc/helpers": "0.5.5", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", @@ -9397,15 +9397,15 @@ "node": ">=18.17.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "14.2.15", - "@next/swc-darwin-x64": "14.2.15", - "@next/swc-linux-arm64-gnu": "14.2.15", - "@next/swc-linux-arm64-musl": "14.2.15", - "@next/swc-linux-x64-gnu": "14.2.15", - "@next/swc-linux-x64-musl": "14.2.15", - "@next/swc-win32-arm64-msvc": "14.2.15", - "@next/swc-win32-ia32-msvc": "14.2.15", - "@next/swc-win32-x64-msvc": "14.2.15" + "@next/swc-darwin-arm64": "14.2.21", + "@next/swc-darwin-x64": "14.2.21", + "@next/swc-linux-arm64-gnu": "14.2.21", + "@next/swc-linux-arm64-musl": "14.2.21", + "@next/swc-linux-x64-gnu": "14.2.21", + "@next/swc-linux-x64-musl": "14.2.21", + "@next/swc-win32-arm64-msvc": "14.2.21", + "@next/swc-win32-ia32-msvc": "14.2.21", + "@next/swc-win32-x64-msvc": "14.2.21" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", @@ -15418,9 +15418,9 @@ } }, "@next/env": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.15.tgz", - "integrity": "sha512-S1qaj25Wru2dUpcIZMjxeMVSwkt8BK4dmWHHiBuRstcIyOsMapqT4A4jSB6onvqeygkSSmOkyny9VVx8JIGamQ==" + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.21.tgz", + "integrity": "sha512-lXcwcJd5oR01tggjWJ6SrNNYFGuOOMB9c251wUNkjCpkoXOPkDeF/15c3mnVlBqrW4JJXb2kVxDFhC4GduJt2A==" }, "@next/eslint-plugin-next": { "version": "13.4.12", @@ -15446,57 +15446,57 @@ } }, "@next/swc-darwin-arm64": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.15.tgz", - "integrity": "sha512-Rvh7KU9hOUBnZ9TJ28n2Oa7dD9cvDBKua9IKx7cfQQ0GoYUwg9ig31O2oMwH3wm+pE3IkAQ67ZobPfEgurPZIA==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.21.tgz", + "integrity": "sha512-HwEjcKsXtvszXz5q5Z7wCtrHeTTDSTgAbocz45PHMUjU3fBYInfvhR+ZhavDRUYLonm53aHZbB09QtJVJj8T7g==", "optional": true }, "@next/swc-darwin-x64": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.15.tgz", - "integrity": "sha512-5TGyjFcf8ampZP3e+FyCax5zFVHi+Oe7sZyaKOngsqyaNEpOgkKB3sqmymkZfowy3ufGA/tUgDPPxpQx931lHg==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.21.tgz", + "integrity": "sha512-TSAA2ROgNzm4FhKbTbyJOBrsREOMVdDIltZ6aZiKvCi/v0UwFmwigBGeqXDA97TFMpR3LNNpw52CbVelkoQBxA==", "optional": true }, "@next/swc-linux-arm64-gnu": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.15.tgz", - "integrity": "sha512-3Bwv4oc08ONiQ3FiOLKT72Q+ndEMyLNsc/D3qnLMbtUYTQAmkx9E/JRu0DBpHxNddBmNT5hxz1mYBphJ3mfrrw==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.21.tgz", + "integrity": "sha512-0Dqjn0pEUz3JG+AImpnMMW/m8hRtl1GQCNbO66V1yp6RswSTiKmnHf3pTX6xMdJYSemf3O4Q9ykiL0jymu0TuA==", "optional": true }, "@next/swc-linux-arm64-musl": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.15.tgz", - "integrity": "sha512-k5xf/tg1FBv/M4CMd8S+JL3uV9BnnRmoe7F+GWC3DxkTCD9aewFRH1s5rJ1zkzDa+Do4zyN8qD0N8c84Hu96FQ==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.21.tgz", + "integrity": "sha512-Ggfw5qnMXldscVntwnjfaQs5GbBbjioV4B4loP+bjqNEb42fzZlAaK+ldL0jm2CTJga9LynBMhekNfV8W4+HBw==", "optional": true }, "@next/swc-linux-x64-gnu": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.15.tgz", - "integrity": "sha512-kE6q38hbrRbKEkkVn62reLXhThLRh6/TvgSP56GkFNhU22TbIrQDEMrO7j0IcQHcew2wfykq8lZyHFabz0oBrA==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.21.tgz", + "integrity": "sha512-uokj0lubN1WoSa5KKdThVPRffGyiWlm/vCc/cMkWOQHw69Qt0X1o3b2PyLLx8ANqlefILZh1EdfLRz9gVpG6tg==", "optional": true }, "@next/swc-linux-x64-musl": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.15.tgz", - "integrity": "sha512-PZ5YE9ouy/IdO7QVJeIcyLn/Rc4ml9M2G4y3kCM9MNf1YKvFY4heg3pVa/jQbMro+tP6yc4G2o9LjAz1zxD7tQ==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.21.tgz", + "integrity": "sha512-iAEBPzWNbciah4+0yI4s7Pce6BIoxTQ0AGCkxn/UBuzJFkYyJt71MadYQkjPqCQCJAFQ26sYh7MOKdU+VQFgPg==", "optional": true }, "@next/swc-win32-arm64-msvc": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.15.tgz", - "integrity": "sha512-2raR16703kBvYEQD9HNLyb0/394yfqzmIeyp2nDzcPV4yPjqNUG3ohX6jX00WryXz6s1FXpVhsCo3i+g4RUX+g==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.21.tgz", + "integrity": "sha512-plykgB3vL2hB4Z32W3ktsfqyuyGAPxqwiyrAi2Mr8LlEUhNn9VgkiAl5hODSBpzIfWweX3er1f5uNpGDygfQVQ==", "optional": true }, "@next/swc-win32-ia32-msvc": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.15.tgz", - "integrity": "sha512-fyTE8cklgkyR1p03kJa5zXEaZ9El+kDNM5A+66+8evQS5e/6v0Gk28LqA0Jet8gKSOyP+OTm/tJHzMlGdQerdQ==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.21.tgz", + "integrity": "sha512-w5bacz4Vxqrh06BjWgua3Yf7EMDb8iMcVhNrNx8KnJXt8t+Uu0Zg4JHLDL/T7DkTCEEfKXO/Er1fcfWxn2xfPA==", "optional": true }, "@next/swc-win32-x64-msvc": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.15.tgz", - "integrity": "sha512-SzqGbsLsP9OwKNUG9nekShTwhj6JSB9ZLMWQ8g1gG6hdE5gQLncbnbymrwy2yVmH9nikSLYRYxYMFu78Ggp7/g==", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.21.tgz", + "integrity": "sha512-sT6+llIkzpsexGYZq8cjjthRyRGe5cJVhqh12FmlbxHqna6zsDDK8UNaV7g41T6atFHCJUPeLb3uyAwrBwy0NA==", "optional": true }, "@nodelib/fs.scandir": { @@ -20633,20 +20633,20 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, "next": { - "version": "14.2.15", - "resolved": "https://registry.npmjs.org/next/-/next-14.2.15.tgz", - "integrity": "sha512-h9ctmOokpoDphRvMGnwOJAedT6zKhwqyZML9mDtspgf4Rh3Pn7UTYKqePNoDvhsWBAO5GoPNYshnAUGIazVGmw==", - "requires": { - "@next/env": "14.2.15", - "@next/swc-darwin-arm64": "14.2.15", - "@next/swc-darwin-x64": "14.2.15", - "@next/swc-linux-arm64-gnu": "14.2.15", - "@next/swc-linux-arm64-musl": "14.2.15", - "@next/swc-linux-x64-gnu": "14.2.15", - "@next/swc-linux-x64-musl": "14.2.15", - "@next/swc-win32-arm64-msvc": "14.2.15", - "@next/swc-win32-ia32-msvc": "14.2.15", - "@next/swc-win32-x64-msvc": "14.2.15", + "version": "14.2.21", + "resolved": "https://registry.npmjs.org/next/-/next-14.2.21.tgz", + "integrity": "sha512-rZmLwucLHr3/zfDMYbJXbw0ZeoBpirxkXuvsJbk7UPorvPYZhP7vq7aHbKnU7dQNCYIimRrbB2pp3xmf+wsYUg==", + "requires": { + "@next/env": "14.2.21", + "@next/swc-darwin-arm64": "14.2.21", + "@next/swc-darwin-x64": "14.2.21", + "@next/swc-linux-arm64-gnu": "14.2.21", + "@next/swc-linux-arm64-musl": "14.2.21", + "@next/swc-linux-x64-gnu": "14.2.21", + "@next/swc-linux-x64-musl": "14.2.21", + "@next/swc-win32-arm64-msvc": "14.2.21", + "@next/swc-win32-ia32-msvc": "14.2.21", + "@next/swc-win32-x64-msvc": "14.2.21", "@swc/helpers": "0.5.5", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", diff --git a/package.json b/package.json index 2d4984b74..b4b171f34 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "highlight.js": "^11.9.0", "highlightjs-rescript": "^0.2.2", "lz-string": "^1.4.4", - "next": "^14.2.15", + "next": "^14.2.21", "next-mdx-remote": "^4.4.1", "prettier": "^1.18.2", "react": "^18.2.0", From 27eedd34be4b502ad6838767c27ed5c149ad2fbc Mon Sep 17 00:00:00 2001 From: Lucas Guellis de Souza <74273532+lucasguellis@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:05:55 -0300 Subject: [PATCH 02/67] Provide entire docs in a single text file for LLMs. (#962) * feat: script for generating llm files * feat: adding mdx files on generating llm * feat: adding llms to sidebar + redirects to latest * fix: format * fix: changing to RegExp and String Rescript Core types * feat: adding redirect for `next` version --- .gitignore | 5 ++ data/sidebar_manual_v1100.json | 3 +- data/sidebar_manual_v1200.json | 3 +- data/sidebar_react_latest.json | 3 + data/sidebar_react_v0100.json | 3 + data/sidebar_react_v0110.json | 3 + next.config.mjs | 10 +++ package.json | 3 +- public/_redirects | 3 + public/llms/manual/template.mdx | 23 ++++++ public/llms/manual/template.txt | 19 +++++ public/llms/react/template.mdx | 23 ++++++ public/llms/react/template.txt | 19 +++++ scripts/generate_llms.res | 137 ++++++++++++++++++++++++++++++++ src/bindings/Node.res | 3 + 15 files changed, 257 insertions(+), 3 deletions(-) create mode 100644 public/llms/manual/template.mdx create mode 100644 public/llms/manual/template.txt create mode 100644 public/llms/react/template.mdx create mode 100644 public/llms/react/template.txt create mode 100644 scripts/generate_llms.res diff --git a/.gitignore b/.gitignore index 4b6ddf80c..d364e12a7 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,8 @@ lib/ src/**/*.mjs scripts/**/*.mjs + +# Generated via generate-llms script +public/llms/manual/**/llm*.txt +public/llms/react/**/llm*.txt +pages/docs/**/**/llms.mdx diff --git a/data/sidebar_manual_v1100.json b/data/sidebar_manual_v1100.json index 6e6c86255..a7672bb98 100644 --- a/data/sidebar_manual_v1100.json +++ b/data/sidebar_manual_v1100.json @@ -73,6 +73,7 @@ "Extra": [ "newcomer-examples", "project-structure", - "faq" + "faq", + "llms" ] } \ No newline at end of file diff --git a/data/sidebar_manual_v1200.json b/data/sidebar_manual_v1200.json index d783a4eb3..a68a5336c 100644 --- a/data/sidebar_manual_v1200.json +++ b/data/sidebar_manual_v1200.json @@ -72,6 +72,7 @@ "Extra": [ "newcomer-examples", "project-structure", - "faq" + "faq", + "llms" ] } \ No newline at end of file diff --git a/data/sidebar_react_latest.json b/data/sidebar_react_latest.json index 758517284..a2a47d615 100644 --- a/data/sidebar_react_latest.json +++ b/data/sidebar_react_latest.json @@ -31,5 +31,8 @@ "beyond-jsx", "forwarding-refs", "extensions-of-props" + ], + "Extra": [ + "llms" ] } \ No newline at end of file diff --git a/data/sidebar_react_v0100.json b/data/sidebar_react_v0100.json index b6bd3b260..43b20d93e 100644 --- a/data/sidebar_react_v0100.json +++ b/data/sidebar_react_v0100.json @@ -26,5 +26,8 @@ "Guides": [ "beyond-jsx", "forwarding-refs" + ], + "Extra": [ + "llms" ] } \ No newline at end of file diff --git a/data/sidebar_react_v0110.json b/data/sidebar_react_v0110.json index f7e96a22c..0876b0888 100644 --- a/data/sidebar_react_v0110.json +++ b/data/sidebar_react_v0110.json @@ -27,5 +27,8 @@ "beyond-jsx", "forwarding-refs", "extensions-of-props" + ], + "Extra": [ + "llms" ] } \ No newline at end of file diff --git a/next.config.mjs b/next.config.mjs index d8b12ed46..eb31e01f3 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -136,6 +136,16 @@ const config = { destination: `/docs/manual/${process.env.VERSION_NEXT}/:slug*`, permanent: false, }, + { + source: "/llms/manual/latest/:file*", + destination: `/llms/manual/${process.env.VERSION_LATEST}/:file*`, + permanent: false, + }, + { + source: "/llms/manual/next/:file*", + destination: `/llms/manual/${process.env.VERSION_NEXT}/:file*`, + permanent: false, + }, ]; }, }; diff --git a/package.json b/package.json index b4b171f34..271070c67 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,8 @@ "build": "rescript && npm run update-index && next build", "test": "node scripts/test-examples.mjs && node scripts/test-hrefs.mjs", "reanalyze": "reanalyze -all-cmt .", - "update-index": "node scripts/extract-indices.mjs && node scripts/extract-tocs.mjs && node scripts/extract-syntax.mjs && node scripts/generate_feed.mjs > public/blog/feed.xml" + "update-index": "npm run generate-llms && node scripts/extract-indices.mjs && node scripts/extract-tocs.mjs && node scripts/extract-syntax.mjs && node scripts/generate_feed.mjs > public/blog/feed.xml", + "generate-llms": "node scripts/generate_llms.mjs" }, "devDependencies": { "@mdx-js/react": "^2.3.0", diff --git a/public/_redirects b/public/_redirects index e0e869325..9c18f7af1 100644 --- a/public/_redirects +++ b/public/_redirects @@ -11,3 +11,6 @@ /docs/manual/latest/:slug* /docs/manual/v11.0.0/:slug* 307 /docs/manual/next/:slug* /docs/manual/v12.0.0/:slug* 307 + +/llms/manual/latest/:file* /llms/manual/v11.0.0/:file* 307 +/llms/manual/next/:file* /llms/manual/v12.0.0/:file* 307 diff --git a/public/llms/manual/template.mdx b/public/llms/manual/template.mdx new file mode 100644 index 000000000..975c1a8c3 --- /dev/null +++ b/public/llms/manual/template.mdx @@ -0,0 +1,23 @@ +--- +title: "LLMs" +description: "Documentation for LLMs" +canonical: "/docs/manual//llms" +--- + +# Documentation for LLMs + +We adhere to the [llms.txt convention](https://llmstxt.org/) to make documentation accessible to large language models and their applications. + +Currently, we have the following files... + +- [/docs/manual/llms.txt](/llms/manual//llms.txt) — a list of the available files for ReScript language. +- [/docs/manual/llm-full.txt](/llms/manual//llm-full.txt) — complete documentation for ReScript language. +- [/docs/manual/llm-small.txt](/llms/manual//llm-small.txt) — compressed version of the former, without examples. + +...and package-level documentation: + +- [/docs/react/llms](/docs/react/latest/llms) — the LLms documentation for ReScript React. + +## Notes + +- The content is automatically generated from the same source as the official documentation for the specific version diff --git a/public/llms/manual/template.txt b/public/llms/manual/template.txt new file mode 100644 index 000000000..d4474f163 --- /dev/null +++ b/public/llms/manual/template.txt @@ -0,0 +1,19 @@ +# ReScript Documentation for LLMs + +> ReScript is a robustly typed language that compiles to efficient and human-readable JavaScript. It comes with a lightning fast compiler toolchain that scales to any codebase size. + +## Documentation Sets + +- [Complete documentation](https://rescript-lang.org/llms/manual//llm-full.txt): The complete ReScript documentation including all examples and additional content +- [Abridged documentation](https://rescript-lang.org/llms/manual//llm-small.txt): A minimal version of the ReScript documentation, with the essential content for quick reference + +## Individual Package Documentation + +- [ReScript React documentation](https://rescript-lang.org/llms/react/latest/llms.txt): This is the developer documentation for ReScript React. + +## Notes + +- The abridged documentation excludes the detailed examples, and supplementary information +- The complete documentation includes all content from the official documentation +- Package-specific documentation files contain only the content relevant to that package +- The content is automatically generated from the same source as the official documentation for the specific version \ No newline at end of file diff --git a/public/llms/react/template.mdx b/public/llms/react/template.mdx new file mode 100644 index 000000000..580a23302 --- /dev/null +++ b/public/llms/react/template.mdx @@ -0,0 +1,23 @@ +--- +title: "LLMs" +description: "Documentation for LLMs" +canonical: "/docs/react//llms" +--- + +# Documentation for LLMs + +We adhere to the [llms.txt convention](https://llmstxt.org/) to make documentation accessible to large language models and their applications. + +Currently, we have the following files... + +- [/docs/react/llms.txt](/llms/react//llms.txt) — a list of the available files for ReScript React. +- [/docs/react/llms-full.txt](/llms/react//llm-full.txt) — complete documentation for ReScript React. +- [/docs/react/llms-small.txt](/llms/react//llm-small.txt) — compressed version of the former, without examples for ReScript React. + +...and the language documentation: + +- [/docs/manual/llms](/docs/manual/latest/llms) — the LLms documentation for ReScript. + +## Notes + +- The content is automatically generated from the same source as the official documentation for the specific version diff --git a/public/llms/react/template.txt b/public/llms/react/template.txt new file mode 100644 index 000000000..0023e410a --- /dev/null +++ b/public/llms/react/template.txt @@ -0,0 +1,19 @@ +# ReScript React Documentation for LLMs + +> ReScript React is a strongly typed interface for React, designed to integrate seamlessly with modern React (>= v18.0) while compiling to idiomatic JavaScript, enabling robust and scalable React applications. + +## ReScript React Documentation + +- [Complete documentation](https://rescript-lang.org/llms/react//llm-full.txt): The complete ReScript React documentation including all examples and additional content +- [Abridged documentation](https://rescript-lang.org/llms/react//llm-small.txt): A minimal version of the ReScript React documentation, with the essential content for quick reference + +## Language Documentation + +- [ReScript documentation](https://rescript-lang.org/llms/manual/latest/llms.txt): This is the developer documentation for ReScript. + +## Notes + +- The abridged documentation excludes the detailed examples, and supplementary information +- The complete documentation includes all content from the official documentation +- Package-specific documentation files contain only the content relevant to that package +- The content is automatically generated from the same source as the official documentation for the specific version \ No newline at end of file diff --git a/scripts/generate_llms.res b/scripts/generate_llms.res new file mode 100644 index 000000000..d86c5d9c0 --- /dev/null +++ b/scripts/generate_llms.res @@ -0,0 +1,137 @@ +let readMarkdownFile = (filePath: string): string => { + let fileContent = Node.Fs.readFileSync2(filePath, "utf8") + fileContent +} + +let rec collectFiles = (dirPath: string): array => { + let entries = Node.Fs.readdirSync(dirPath) + entries->Array.reduce([], (acc, entry) => { + let fullPath = Node.Path.join([dirPath, entry]) + let stats = Node.Fs.statSync(fullPath) + switch stats["isDirectory"]() { + | true => acc->Array.concat(collectFiles(fullPath)) + | false => { + acc->Array.push(fullPath) + acc + } + } + }) +} + +let clearFile = (filePath: string): unit => { + Node.Fs.writeFileSync(filePath, "") +} + +let createDirectoryIfNotExists = (dirPath: string): unit => { + if !Node.Fs.existsSync(dirPath) { + Node.Fs.mkdirSync(dirPath) + } +} + +let removeCodeTabTags = (content: string): string => { + let regex = RegExp.fromStringWithFlags("[\\s\\S]*?", ~flags="g") + String.replaceRegExp(content, regex, "") +} + +let removeCodeBlocks = (content: string): string => { + let regex = RegExp.fromStringWithFlags("```[a-zA-Z]+\\s*[\\s\\S]*?```", ~flags="g") + String.replaceRegExp(content, regex, "") +} + +let removeFileTitle = (content: string): string => { + let regex = RegExp.fromStringWithFlags("---\ntitle[\\s\\S]*?---", ~flags="g") + String.replaceRegExp(content, regex, "") +} + +let removeUnnecessaryBreaks = (content: string): string => { + let regex = RegExp.fromStringWithFlags("^\n{2,}", ~flags="g") + String.replaceRegExp(content, regex, "") +} + +let removeToDos = (content: string): string => { + let regex = RegExp.fromStringWithFlags("", ~flags="g") + String.replaceRegExp(content, regex, "") +} + +let fillContentWithVersion = (content: string, version: string): string => { + let regex = RegExp.fromStringWithFlags("", ~flags="g") + String.replaceRegExp(content, regex, version) +} + +let createFullFile = (content: string, filePath: string): unit => { + Node.Fs.appendFileSync(filePath, content ++ "\n", "utf8") +} + +let createSmallFile = (content: string, filePath: string): unit => { + let smallContent = + content + ->removeCodeTabTags + ->removeFileTitle + ->removeToDos + ->removeCodeBlocks + ->removeUnnecessaryBreaks + Node.Fs.appendFileSync(filePath, smallContent, "utf8") +} + +let createLlmsFiles = (version: string, docsDirectory: string, llmsDirectory: string): unit => { + let mdxFileTemplatePath = llmsDirectory->Node.Path.join2("template.mdx") + let mdxFilePath = docsDirectory->Node.Path.join2(version)->Node.Path.join2("llms.mdx") + let txtFileTemplatePath = llmsDirectory->Node.Path.join2("template.txt") + let txtFilePath = llmsDirectory->Node.Path.join2(version)->Node.Path.join2("llms.txt") + + Node.Fs.writeFileSync( + mdxFilePath, + readMarkdownFile(mdxFileTemplatePath)->fillContentWithVersion(version), + ) + + Node.Fs.writeFileSync( + txtFilePath, + readMarkdownFile(txtFileTemplatePath)->fillContentWithVersion(version), + ) +} + +let processVersions = ( + versions: array, + docsDirectory: string, + llmsDirectory: string, +): unit => { + let fullFileName = "llm-full.txt" + let smallFileName = "llm-small.txt" + + versions->Array.forEach(version => { + let versionDir = docsDirectory->Node.Path.join2(version) + let llmsDir = llmsDirectory->Node.Path.join2(version) + let fullFilePath = llmsDir->Node.Path.join2(fullFileName) + let smallFilePath = llmsDir->Node.Path.join2(smallFileName) + + createDirectoryIfNotExists(llmsDir) + clearFile(fullFilePath) + clearFile(smallFilePath) + + createLlmsFiles(version, docsDirectory, llmsDirectory) + + versionDir + ->collectFiles + ->Array.forEach(filePath => { + if String.endsWith(filePath, ".mdx") { + let content = readMarkdownFile(filePath) + + content->createFullFile(fullFilePath) + + content->createSmallFile(smallFilePath) + } + }) + }) +} + +let manualVersions = ["v12.0.0", "v11.0.0"] +let reactManualVersions = ["latest", "v0.10.0", "v0.11.0"] + +let manualDocsDirectory = "pages/docs/manual" +let reactDocsDirectory = "pages/docs/react" + +let manualLlmsDirectory = "public/llms/manual" +let reactLlmsDirectory = "public/llms/react" + +processVersions(manualVersions, manualDocsDirectory, manualLlmsDirectory) +processVersions(reactManualVersions, reactDocsDirectory, reactLlmsDirectory) diff --git a/src/bindings/Node.res b/src/bindings/Node.res index d688f7baa..44bcd522b 100644 --- a/src/bindings/Node.res +++ b/src/bindings/Node.res @@ -20,10 +20,13 @@ module Process = { module Fs = { @module("fs") external readFileSync: string => string = "readFileSync" + @module("fs") external readFileSync2: (string, string) => string = "readFileSync" @module("fs") external readdirSync: string => array = "readdirSync" @module("fs") external writeFileSync: (string, string) => unit = "writeFileSync" + @module("fs") external appendFileSync: (string, string, string) => unit = "appendFileSync" @module("fs") external existsSync: string => bool = "existsSync" @module("fs") external mkdirSync: string => unit = "mkdirSync" + @module("fs") external statSync: string => {.."isDirectory": unit => bool} = "statSync" } module Buffer = { From f1fa193096e71cb3d49069ec7768fda28d5d3833 Mon Sep 17 00:00:00 2001 From: Henrikh Kantuni Date: Mon, 27 Jan 2025 04:03:13 -0500 Subject: [PATCH 03/67] Fix typo (#963) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix typo "is the primary ReScript features" → "is the primary ReScript feature" * Fix typo (v8) * Fix typo (v9) * Fix typo (v10) * Fix typo (v11) --- pages/docs/manual/v10.0.0/external.mdx | 2 +- pages/docs/manual/v11.0.0/external.mdx | 2 +- pages/docs/manual/v12.0.0/external.mdx | 2 +- pages/docs/manual/v8.0.0/external.mdx | 2 +- pages/docs/manual/v9.0.0/external.mdx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/docs/manual/v10.0.0/external.mdx b/pages/docs/manual/v10.0.0/external.mdx index e5999cc22..f0845d582 100644 --- a/pages/docs/manual/v10.0.0/external.mdx +++ b/pages/docs/manual/v10.0.0/external.mdx @@ -6,7 +6,7 @@ canonical: "/docs/manual/latest/external" # External (Bind to Any JS Library) -`external` is the primary ReScript features for bringing in and using JavaScript values. +`external` is the primary ReScript feature for bringing in and using JavaScript values. `external` is like a let binding, but: - The right side of `=` isn't a value; it's the name of the JS value you're referring to. diff --git a/pages/docs/manual/v11.0.0/external.mdx b/pages/docs/manual/v11.0.0/external.mdx index b4d3a89f9..f3cfaaa32 100644 --- a/pages/docs/manual/v11.0.0/external.mdx +++ b/pages/docs/manual/v11.0.0/external.mdx @@ -6,7 +6,7 @@ canonical: "/docs/manual/v11.0.0/external" # External (Bind to Any JS Library) -`external` is the primary ReScript features for bringing in and using JavaScript values. +`external` is the primary ReScript feature for bringing in and using JavaScript values. `external` is like a let binding, but: - The right side of `=` isn't a value; it's the name of the JS value you're referring to. diff --git a/pages/docs/manual/v12.0.0/external.mdx b/pages/docs/manual/v12.0.0/external.mdx index fd91010dd..829da3879 100644 --- a/pages/docs/manual/v12.0.0/external.mdx +++ b/pages/docs/manual/v12.0.0/external.mdx @@ -6,7 +6,7 @@ canonical: "/docs/manual/v12.0.0/external" # External (Bind to Any JS Library) -`external` is the primary ReScript features for bringing in and using JavaScript values. +`external` is the primary ReScript feature for bringing in and using JavaScript values. `external` is like a let binding, but: - The right side of `=` isn't a value; it's the name of the JS value you're referring to. diff --git a/pages/docs/manual/v8.0.0/external.mdx b/pages/docs/manual/v8.0.0/external.mdx index 32aa1b2e6..dea30c09c 100644 --- a/pages/docs/manual/v8.0.0/external.mdx +++ b/pages/docs/manual/v8.0.0/external.mdx @@ -6,7 +6,7 @@ canonical: "/docs/manual/latest/external" # External (Bind to Any JS Library) -`external` is the primary ReScript features for bringing in and using JavaScript values. +`external` is the primary ReScript feature for bringing in and using JavaScript values. `external` is like a let binding, but: - The right side of `=` isn't a value; it's the name of the JS value you're referring to. diff --git a/pages/docs/manual/v9.0.0/external.mdx b/pages/docs/manual/v9.0.0/external.mdx index 11d9552c9..95cddbe3d 100644 --- a/pages/docs/manual/v9.0.0/external.mdx +++ b/pages/docs/manual/v9.0.0/external.mdx @@ -6,7 +6,7 @@ canonical: "/docs/manual/latest/external" # External (Bind to Any JS Library) -`external` is the primary ReScript features for bringing in and using JavaScript values. +`external` is the primary ReScript feature for bringing in and using JavaScript values. `external` is like a let binding, but: - The right side of `=` isn't a value; it's the name of the JS value you're referring to. From fc636afd01f686a031d03a752ff857358ed6f230 Mon Sep 17 00:00:00 2001 From: Henrikh Kantuni Date: Tue, 28 Jan 2025 05:03:06 -0500 Subject: [PATCH 04/67] Fix typo in the "Object Method" section (#965) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix typo "is the primary ReScript features" → "is the primary ReScript feature" * Fix typo (v8) * Fix typo (v9) * Fix typo (v10) * Fix typo (v11) * Fix typo in the "Object Method" section (v8) "to a JS objects" → "to JS objects" * Fix typo (v12) * Fix typo (v11) * Fix typo (v10) * Fix typo (v9) --- pages/docs/manual/v10.0.0/bind-to-js-function.mdx | 2 +- pages/docs/manual/v11.0.0/bind-to-js-function.mdx | 2 +- pages/docs/manual/v12.0.0/bind-to-js-function.mdx | 2 +- pages/docs/manual/v8.0.0/bind-to-js-function.mdx | 2 +- pages/docs/manual/v9.0.0/bind-to-js-function.mdx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/docs/manual/v10.0.0/bind-to-js-function.mdx b/pages/docs/manual/v10.0.0/bind-to-js-function.mdx index 90a2ab899..891042463 100644 --- a/pages/docs/manual/v10.0.0/bind-to-js-function.mdx +++ b/pages/docs/manual/v10.0.0/bind-to-js-function.mdx @@ -84,7 +84,7 @@ MyGame.draw(10, 20, undefined); ## Object Method -Functions attached to a JS objects (other than JS modules) require a special way of binding to them, using `send`: +Functions attached to JS objects (other than JS modules) require a special way of binding to them, using `send`: diff --git a/pages/docs/manual/v11.0.0/bind-to-js-function.mdx b/pages/docs/manual/v11.0.0/bind-to-js-function.mdx index f893d693b..f29c8abd8 100644 --- a/pages/docs/manual/v11.0.0/bind-to-js-function.mdx +++ b/pages/docs/manual/v11.0.0/bind-to-js-function.mdx @@ -82,7 +82,7 @@ MyGame.draw(10, 20, undefined); ## Object Method -Functions attached to a JS objects (other than JS modules) require a special way of binding to them, using `send`: +Functions attached to JS objects (other than JS modules) require a special way of binding to them, using `send`: diff --git a/pages/docs/manual/v12.0.0/bind-to-js-function.mdx b/pages/docs/manual/v12.0.0/bind-to-js-function.mdx index 360ed48a0..1f0fe26a7 100644 --- a/pages/docs/manual/v12.0.0/bind-to-js-function.mdx +++ b/pages/docs/manual/v12.0.0/bind-to-js-function.mdx @@ -82,7 +82,7 @@ MyGame.draw(10, 20, undefined); ## Object Method -Functions attached to a JS objects (other than JS modules) require a special way of binding to them, using `send`: +Functions attached to JS objects (other than JS modules) require a special way of binding to them, using `send`: diff --git a/pages/docs/manual/v8.0.0/bind-to-js-function.mdx b/pages/docs/manual/v8.0.0/bind-to-js-function.mdx index 7b67f769d..3aed460ca 100644 --- a/pages/docs/manual/v8.0.0/bind-to-js-function.mdx +++ b/pages/docs/manual/v8.0.0/bind-to-js-function.mdx @@ -103,7 +103,7 @@ MyGame.draw(10, 20, undefined); ## Object Method -Functions attached to a JS objects (other than JS modules) require a special way of binding to them, using `bs.send`: +Functions attached to JS objects (other than JS modules) require a special way of binding to them, using `bs.send`: diff --git a/pages/docs/manual/v9.0.0/bind-to-js-function.mdx b/pages/docs/manual/v9.0.0/bind-to-js-function.mdx index a1ab78b21..303781bdf 100644 --- a/pages/docs/manual/v9.0.0/bind-to-js-function.mdx +++ b/pages/docs/manual/v9.0.0/bind-to-js-function.mdx @@ -84,7 +84,7 @@ MyGame.draw(10, 20, undefined); ## Object Method -Functions attached to a JS objects (other than JS modules) require a special way of binding to them, using `send`: +Functions attached to JS objects (other than JS modules) require a special way of binding to them, using `send`: From a71ae31221e3045a9654bed300b01f97ed70e62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Tsnobiladz=C3=A9?= Date: Thu, 30 Jan 2025 20:51:12 +0100 Subject: [PATCH 05/67] load stdlib runtime in playground (#964) --- package.json | 1 + src/RenderPanel.res | 12 +++-- src/bindings/Babel.res | 84 ++++++++++++++++++++++------- src/bindings/Webapi.res | 3 ++ src/common/CompilerManagerHook.res | 3 ++ src/common/CompilerManagerHook.resi | 4 ++ src/common/EvalIFrame.res | 19 ++++--- 7 files changed, 99 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 271070c67..ef6303763 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ }, "scripts": { "dev": "next", + "res:watch": "rescript build -w", "build": "rescript && npm run update-index && next build", "test": "node scripts/test-examples.mjs && node scripts/test-hrefs.mjs", "reanalyze": "reanalyze -all-cmt .", diff --git a/src/RenderPanel.res b/src/RenderPanel.res index afd14106d..7fa692790 100644 --- a/src/RenderPanel.res +++ b/src/RenderPanel.res @@ -10,14 +10,20 @@ let make = (~compilerState: CompilerManagerHook.state, ~clearLogs, ~runOutput) = React.useEffect(() => { if runOutput { switch compilerState { - | CompilerManagerHook.Ready({result: Comp(Success({js_code}))}) => + | CompilerManagerHook.Ready({selected, result: Comp(Success({js_code}))}) => clearLogs() open Babel let ast = Parser.parse(js_code, {sourceType: "module"}) - let {entryPointExists, code} = PlaygroundValidator.validate(ast) + let {entryPointExists, code, imports} = PlaygroundValidator.validate(ast) + let imports = imports->Dict.mapValues(path => { + let filename = path->String.sliceToEnd(~start=9) // the part after "./stdlib/" + CompilerManagerHook.CdnMeta.getStdlibRuntimeUrl(selected.id, filename) + }) - entryPointExists ? code->wrapReactApp->EvalIFrame.sendOutput : EvalIFrame.sendOutput(code) + entryPointExists + ? code->wrapReactApp->EvalIFrame.sendOutput(imports) + : EvalIFrame.sendOutput(code, imports) setValidReact(_ => entryPointExists) | _ => () } diff --git a/src/bindings/Babel.res b/src/bindings/Babel.res index 2726555e4..93f120809 100644 --- a/src/bindings/Babel.res +++ b/src/bindings/Babel.res @@ -10,14 +10,48 @@ module Ast = { @tag("type") type expression = ObjectExpression({properties: array}) - type variableDeclarator = { - @as("type") type_: string, - id: lval, - init?: Null.t, + module VariableDeclarator = { + @tag("type") + type t = VariableDeclarator({id: lval, init?: Null.t}) } + module Specifier = { + @tag("type") + type t = + | ImportSpecifier({local: lval}) + | ImportDefaultSpecifier({local: lval}) + | ImportNamespaceSpecifier({local: lval}) + } + + module StringLiteral = { + @tag("type") + type t = StringLiteral({value: string}) + } + + module VariableDeclaration = { + @tag("type") + type t = VariableDeclaration({kind: string, declarations: array}) + } + + module ImportDeclaration = { + @tag("type") + type t = ImportDeclaration({specifiers: array, source: StringLiteral.t}) + } + + module Identifier = { + @tag("type") + type t = Identifier({mutable name: string}) + } + @tag("type") - type node = VariableDeclaration({kind: string, declarations: array}) - type nodePath = {node: node} + type node = + | ...StringLiteral.t + | ...Specifier.t + | ...VariableDeclarator.t + | ...VariableDeclaration.t + | ...ImportDeclaration.t + | ...Identifier.t + + type nodePath<'nodeType> = {node: 'nodeType} } module Parser = { @@ -30,7 +64,7 @@ module Traverse = { } module Generator = { - @send external remove: Ast.nodePath => unit = "remove" + @send external remove: Ast.nodePath<'nodeType> => unit = "remove" type t = {code: string} @module("@babel/generator") external generator: Ast.t => t = "default" @@ -40,26 +74,42 @@ module PlaygroundValidator = { type validator = { entryPointExists: bool, code: string, + imports: Dict.t, } let validate = ast => { let entryPoint = ref(false) + let imports = Dict.make() let remove = nodePath => Generator.remove(nodePath) Traverse.traverse( ast, { - "ImportDeclaration": remove, + "ImportDeclaration": ( + { + node: ImportDeclaration({specifiers, source: StringLiteral({value: source})}), + } as nodePath: Ast.nodePath, + ) => { + if source->String.startsWith("./stdlib") { + switch specifiers { + | [ImportNamespaceSpecifier({local: Identifier({name})})] => + imports->Dict.set(name, source) + | _ => () + } + } + remove(nodePath) + }, "ExportNamedDeclaration": remove, - "VariableDeclaration": (nodePath: Ast.nodePath) => { - switch nodePath.node { - | VariableDeclaration({declarations}) if Array.length(declarations) > 0 => + "VariableDeclaration": ( + {node: VariableDeclaration({declarations})}: Ast.nodePath, + ) => { + if Array.length(declarations) > 0 { let firstDeclaration = Array.getUnsafe(declarations, 0) - switch (firstDeclaration.id, firstDeclaration.init) { - | (Identifier({name}), Some(init)) if name === "App" => - switch init->Null.toOption { - | Some(ObjectExpression({properties})) => + switch firstDeclaration { + | VariableDeclarator({id: Identifier({name}), init}) if name === "App" => + switch init { + | Value(ObjectExpression({properties})) => let foundEntryPoint = properties->Array.find(property => { switch property { | ObjectProperty({ @@ -74,12 +124,10 @@ module PlaygroundValidator = { } | _ => () } - | _ => () } }, }, ) - - {entryPointExists: entryPoint.contents, code: Generator.generator(ast).code} + {entryPointExists: entryPoint.contents, imports, code: Generator.generator(ast).code} } } diff --git a/src/bindings/Webapi.res b/src/bindings/Webapi.res index c25856ec2..55d5eecc8 100644 --- a/src/bindings/Webapi.res +++ b/src/bindings/Webapi.res @@ -27,6 +27,9 @@ module Element = { @send external postMessage: (contentWindow, string, ~targetOrigin: string=?) => unit = "postMessage" + @send + external postMessageAny: (contentWindow, 'a, ~targetOrigin: string=?) => unit = "postMessage" + module Style = { @scope("style") @set external width: (Dom.element, string) => unit = "width" @scope("style") @set external height: (Dom.element, string) => unit = "height" diff --git a/src/common/CompilerManagerHook.res b/src/common/CompilerManagerHook.res index 2a68805fa..4236657ef 100644 --- a/src/common/CompilerManagerHook.res +++ b/src/common/CompilerManagerHook.res @@ -40,6 +40,9 @@ module CdnMeta = { let getLibraryCmijUrl = (version, libraryName: string): string => `https://cdn.rescript-lang.org/${Semver.toString(version)}/${libraryName}/cmij.js` + + let getStdlibRuntimeUrl = (version, filename) => + `https://cdn.rescript-lang.org/${Semver.toString(version)}/compiler-builtins/stdlib/${filename}` } module FinalResult = { diff --git a/src/common/CompilerManagerHook.resi b/src/common/CompilerManagerHook.resi index c8c3b4b3e..5e9f8a826 100644 --- a/src/common/CompilerManagerHook.resi +++ b/src/common/CompilerManagerHook.resi @@ -27,6 +27,10 @@ type ready = { result: FinalResult.t, } +module CdnMeta: { + let getStdlibRuntimeUrl: (Semver.t, string) => string +} + type state = | Init | SetupFailed(string) diff --git a/src/common/EvalIFrame.res b/src/common/EvalIFrame.res index 99e3e5bd4..5736363c3 100644 --- a/src/common/EvalIFrame.res +++ b/src/common/EvalIFrame.res @@ -18,7 +18,6 @@ let srcDoc = `