π₯ Make videos programmatically with React
Docs: Upgrade to new Shiki Twoslasher
Jonny Burger3efa69db63a6
diff --git a/bun.lock b/bun.lockindex 1ad451bad0..07d0a84045 100644--- a/bun.lock+++ b/bun.lock@@ -425,6 +425,7 @@"@remotion/whisper-web": "workspace:*","@remotion/zod-types": "workspace:*","@rive-app/canvas-advanced": "2.31.5",+ "@shikijs/twoslash": "3.22.0","@shopify/react-native-skia": "2.0.0","@swc/core": "^1.3.80","@turf/turf": "7.3.2",@@ -452,7 +453,9 @@"react-dom": "catalog:","remark-shiki-twoslash": "^3.1.3","remotion": "workspace:*",+ "shiki": "3.22.0","three": "catalog:",+ "twoslash": "0.3.6","uuid": "^8.3.2","zod": "catalog:",},@@ -475,11 +478,11 @@"version": "4.0.423","dependencies": {"@docusaurus/types": "3.6.0",+ "@shikijs/twoslash": "3.22.0","@types/dom-webcodecs": "catalog:",- "@typescript/twoslash": "3.2.1","fenceparser": "^2.2.0",- "shiki": "0.10.1",- "shiki-twoslash": "3.1.2",+ "shiki": "3.22.0",+ "twoslash": "0.3.6","unified": "^11.0.5","unist-util-visit": "^5.0.0",},@@ -3825,17 +3828,19 @@"@rushstack/eslint-patch": ["@rushstack/[email protected]", "", {}, "sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA=="],- "@shikijs/core": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0", "@shikijs/vscode-textmate": "10.0.2", "@types/hast": "3.0.4", "hast-util-to-html": "9.0.5" } }, "sha512-oJwU+DxGqp6lUZpvtQgVOXNZcVsirN76tihOLBmwILkKuRuwHteApP8oTXmL4tF5vS5FbOY0+8seXmiCoslk4g=="],+ "@shikijs/core": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.22.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" } }, "sha512-iAlTtSDDbJiRpvgL5ugKEATDtHdUVkqgHDm/gbD2ZS9c88mx7G1zSYjjOxp5Qa0eaW0MAQosFRmJSk354PRoQA=="],- "@shikijs/engine-javascript": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0", "@shikijs/vscode-textmate": "10.0.2", "oniguruma-to-es": "4.3.3" } }, "sha512-6/ov6pxrSvew13k9ztIOnSBOytXeKs5kfIR7vbhdtVRg+KPzvp2HctYGeWkqv7V6YIoLicnig/QF3iajqyElZA=="],+ "@shikijs/engine-javascript": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.22.0", "@shikijs/vscode-textmate": "^10.0.2", "oniguruma-to-es": "^4.3.4" } }, "sha512-jdKhfgW9CRtj3Tor0L7+yPwdG3CgP7W+ZEqSsojrMzCjD1e0IxIbwUMDDpYlVBlC08TACg4puwFGkZfLS+56Tw=="],- "@shikijs/engine-oniguruma": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0", "@shikijs/vscode-textmate": "10.0.2" } }, "sha512-4DwIjIgETK04VneKbfOE4WNm4Q7WC1wo95wv82PoHKdqX4/9qLRUwrfKlmhf0gAuvT6GHy0uc7t9cailk6Tbhw=="],+ "@shikijs/engine-oniguruma": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.22.0", "@shikijs/vscode-textmate": "^10.0.2" } }, "sha512-DyXsOG0vGtNtl7ygvabHd7Mt5EY8gCNqR9Y7Lpbbd/PbJvgWrqaKzH1JW6H6qFkuUa8aCxoiYVv8/YfFljiQxA=="],- "@shikijs/langs": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0" } }, "sha512-Njg/nFL4HDcf/ObxcK2VeyidIq61EeLmocrwTHGGpOQx0BzrPWM1j55XtKQ1LvvDWH15cjQy7rg96aJ1/l63uw=="],+ "@shikijs/langs": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.22.0" } }, "sha512-x/42TfhWmp6H00T6uwVrdTJGKgNdFbrEdhaDwSR5fd5zhQ1Q46bHq9EO61SCEWJR0HY7z2HNDMaBZp8JRmKiIA=="],- "@shikijs/themes": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0" } }, "sha512-BhhWRzCTEk2CtWt4S4bgsOqPJRkapvxdsifAwqP+6mk5uxboAQchc0etiJ0iIasxnMsb764qGD24DK9albcU9Q=="],+ "@shikijs/themes": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.22.0" } }, "sha512-o+tlOKqsr6FE4+mYJG08tfCFDS+3CG20HbldXeVoyP+cYSUxDhrFf3GPjE60U55iOkkjbpY2uC3It/eeja35/g=="],- "@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "10.0.2", "@types/hast": "3.0.4" } }, "sha512-RB7IMo2E7NZHyfkqAuaf4CofyY8bPzjWPjJRzn6SEak3b46fIQyG6Vx5fG/obqkfppQ+g8vEsiD7Uc6lqQt32Q=="],+ "@shikijs/twoslash": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/core": "3.22.0", "@shikijs/types": "3.22.0", "twoslash": "^0.3.6" }, "peerDependencies": { "typescript": ">=5.5.0" } }, "sha512-GO27UPN+kegOMQvC+4XcLt0Mttyg+n16XKjmoKjdaNZoW+sOJV7FLdv2QKauqUDws6nE3EQPD+TFHEdyyoUBDw=="],++ "@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-491iAekgKDBFE67z70Ok5a8KBMsQ2IJwOWw3us/7ffQkIBCyOQfm/aNwVMBUriP02QshIfgHCBSIYAl3u2eWjg=="],"@shikijs/vscode-textmate": ["@shikijs/[email protected]", "", {}, "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg=="],@@ -4607,9 +4612,9 @@"@typescript/native-preview-win32-x64": ["@typescript/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-bje8xm+b0q3OSCY01/MZdDBnVISURunL9rCAob8pAu8qtRMvKYGWUsYwTH+fXGUViPAmdlafFd2E82K9VJYmHA=="],- "@typescript/twoslash": ["@typescript/[email protected]", "", { "dependencies": { "@typescript/vfs": "1.4.0", "debug": "4.4.0", "lz-string": "1.5.0" } }, "sha512-tS4gLwOe1WCDspqBXhQCb2ESUqzEd1tOkmKpiZ1O+W1x+9l+9njETuXFkLErtH9is/uD1GSvClDjk/tEOJktjQ=="],+ "@typescript/twoslash": ["@typescript/[email protected]", "", { "dependencies": { "@typescript/vfs": "1.3.5", "debug": "4.4.0", "lz-string": "1.5.0" } }, "sha512-kTwMUQ8xtAZaC4wb2XuLkPqFVBj2dNBueMQ89NWEuw87k2nLBbuafeG5cob/QEr6YduxIdTVUjix0MtC7mPlmg=="],- "@typescript/vfs": ["@typescript/[email protected]", "", { "dependencies": { "debug": "4.4.0" } }, "sha512-Pood7yv5YWMIX+yCHo176OnF8WUlKGImFG7XlsuH14Zb1YN5+dYD3uUtS7lqZtsH7tAveNUi2NzdpQCN0yRbaw=="],+ "@typescript/vfs": ["@typescript/[email protected]", "", { "dependencies": { "debug": "^4.1.1" }, "peerDependencies": { "typescript": "*" } }, "sha512-8Qs6/Tj2B8Uyo4lYJkopdCtrsfpF/ZlbTXK13Nq6JKN+Ih8FF9Oxg97gEp+zIS96wmkMdWUIETl35Yt9BITeiw=="],"@ungap/structured-clone": ["@ungap/[email protected]", "", {}, "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ=="],@@ -6473,7 +6478,7 @@"oniguruma-parser": ["[email protected]", "", {}, "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w=="],- "oniguruma-to-es": ["[email protected]", "", { "dependencies": { "oniguruma-parser": "0.12.1", "regex": "6.0.1", "regex-recursion": "6.0.2" } }, "sha512-rPiZhzC3wXwE59YQMRDodUwwT9FZ9nNBwQQfsd1wfdtlKEyCdRV0avrTcSZ5xlIvGRVPd/cx6ZN45ECmS39xvg=="],+ "oniguruma-to-es": ["[email protected]", "", { "dependencies": { "oniguruma-parser": "^0.12.1", "regex": "^6.0.1", "regex-recursion": "^6.0.2" } }, "sha512-3VhUGN3w2eYxnTzHn+ikMI+fp/96KoRSVK9/kMTcFqj1NRDh2IhQCKvYxDnWePKRXY/AqH+Fuiyb7VHSzBjHfA=="],"open": ["[email protected]", "", { "dependencies": { "define-lazy-prop": "2.0.0", "is-docker": "2.2.1", "is-wsl": "2.2.0" } }, "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ=="],@@ -7121,7 +7126,7 @@"shell-quote": ["[email protected]", "", {}, "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA=="],- "shiki": ["[email protected]", "", { "dependencies": { "jsonc-parser": "3.2.0", "vscode-oniguruma": "1.7.0", "vscode-textmate": "5.2.0" } }, "sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng=="],+ "shiki": ["[email protected]", "", { "dependencies": { "@shikijs/core": "3.22.0", "@shikijs/engine-javascript": "3.22.0", "@shikijs/engine-oniguruma": "3.22.0", "@shikijs/langs": "3.22.0", "@shikijs/themes": "3.22.0", "@shikijs/types": "3.22.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-LBnhsoYEe0Eou4e1VgJACes+O6S6QC0w71fCSp5Oya79inkwkm15gQ1UF6VtQ8j/taMDh79hAB49WUk8ALQW3g=="],"shiki-twoslash": ["[email protected]", "", { "dependencies": { "@typescript/twoslash": "3.1.0", "@typescript/vfs": "1.3.4", "fenceparser": "1.1.1", "shiki": "0.10.1" }, "peerDependencies": { "typescript": "5.8.2" } }, "sha512-JBcRIIizi+exIA/OUhYkV6jtyeZco0ykCkIRd5sgwIt1Pm4pz+maoaRZpm6SkhPwvif4fCA7xOtJOykhpIV64Q=="],@@ -7501,11 +7506,11 @@"tw-animate-css": ["[email protected]", "", {}, "sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ=="],- "twoslash": ["[email protected]", "", { "dependencies": { "@typescript/vfs": "1.6.1", "twoslash-protocol": "0.3.1" }, "peerDependencies": { "typescript": "5.8.2" } }, "sha512-OGqMTGvqXTcb92YQdwGfEdK0nZJA64Aj/ChLOelbl3TfYch2IoBST0Yx4C0LQ7Lzyqm9RpgcpgDxeXQIz4p2Kg=="],+ "twoslash": ["[email protected]", "", { "dependencies": { "@typescript/vfs": "^1.6.2", "twoslash-protocol": "0.3.6" }, "peerDependencies": { "typescript": "^5.5.0" } }, "sha512-VuI5OKl+MaUO9UIW3rXKoPgHI3X40ZgB/j12VY6h98Ae1mCBihjPvhOPeJWlxCYcmSbmeZt5ZKkK0dsVtp+6pA=="],"twoslash-cdn": ["[email protected]", "", { "dependencies": { "twoslash": "0.3.1" }, "peerDependencies": { "typescript": "5.8.2" } }, "sha512-JbYbEIG82SlBVD03s7PW+VC5cV9zgWHCtdVkBEc38Kqz8D8ZAgPkthzPAj3isaiJo5xTu/Q/R4NYgihcMVmFXQ=="],- "twoslash-protocol": ["[email protected]", "", {}, "sha512-BMePTL9OkuNISSyyMclBBhV2s9++DiOCyhhCoV5Kaht6eaWLwVjCCUJHY33eZJPsyKeZYS8Wzz0h+XI01VohVw=="],+ "twoslash-protocol": ["[email protected]", "", {}, "sha512-FHGsJ9Q+EsNr5bEbgG3hnbkvEBdW5STgPU824AHUjB4kw0Dn4p8tABT7Ncg1Ie6V0+mDg3Qpy41VafZXcQhWMA=="],"type": ["[email protected]", "", {}, "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg=="],@@ -9361,6 +9366,10 @@"@typescript-eslint/visitor-keys/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],+ "@typescript/twoslash/@typescript/vfs": ["@typescript/[email protected]", "", { "dependencies": { "debug": "4.4.1" } }, "sha512-pI8Saqjupf9MfLw7w2+og+fmb0fZS0J6vsKXXrp4/PDXEFvntgzXmChCXC/KefZZS0YGS6AT8e0hGAJcTsdJlg=="],++ "@typescript/vfs/debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],+"@use-gesture/react/react": ["[email protected]", "", {}, "sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ=="],"@vanilla-extract/babel-plugin-debug-ids/@babel/core": ["@babel/[email protected]", "", { "dependencies": { "@ampproject/remapping": "2.3.0", "@babel/code-frame": "7.27.1", "@babel/generator": "7.27.5", "@babel/helper-compilation-targets": "7.27.2", "@babel/helper-module-transforms": "7.27.3", "@babel/helpers": "7.27.6", "@babel/parser": "7.27.5", "@babel/template": "7.27.2", "@babel/traverse": "7.27.4", "@babel/types": "7.27.6", "convert-source-map": "2.0.0", "debug": "4.4.1", "gensync": "1.0.0-beta.2", "json5": "2.2.3", "semver": "6.3.1" } }, "sha512-bXYxrXFubeYdvB0NhD/NBB3Qi6aZeV20GOWVI47t2dkecCEoneR4NPVcb7abpXDEvejgrUfFtG6vG/zxAKmg+g=="],@@ -10313,12 +10322,12 @@"remark-shiki-twoslash/@types/unist": ["@types/[email protected]", "", {}, "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ=="],- "remark-shiki-twoslash/@typescript/twoslash": ["@typescript/[email protected]", "", { "dependencies": { "@typescript/vfs": "1.3.5", "debug": "4.4.0", "lz-string": "1.5.0" } }, "sha512-kTwMUQ8xtAZaC4wb2XuLkPqFVBj2dNBueMQ89NWEuw87k2nLBbuafeG5cob/QEr6YduxIdTVUjix0MtC7mPlmg=="],-"remark-shiki-twoslash/@typescript/vfs": ["@typescript/[email protected]", "", { "dependencies": { "debug": "4.4.0" } }, "sha512-RbyJiaAGQPIcAGWFa3jAXSuAexU4BFiDRF1g3hy7LmRqfNpYlTQWGXjcrOaVZjJ8YkkpuwG0FcsYvtWQpd9igQ=="],"remark-shiki-twoslash/fenceparser": ["[email protected]", "", {}, "sha512-VdkTsK7GWLT0VWMK5S5WTAPn61wJ98WPFwJiRHumhg4ESNUO/tnkU8bzzzc62o6Uk1SVhuZFLnakmDA4SGV7wA=="],+ "remark-shiki-twoslash/shiki": ["[email protected]", "", { "dependencies": { "jsonc-parser": "3.2.0", "vscode-oniguruma": "1.7.0", "vscode-textmate": "5.2.0" } }, "sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng=="],+"remark-shiki-twoslash/tslib": ["[email protected]", "", {}, "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A=="],"remark-shiki-twoslash/unist-util-visit": ["[email protected]", "", { "dependencies": { "@types/unist": "2.0.6", "unist-util-is": "4.1.0", "unist-util-visit-parents": "3.1.1" } }, "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q=="],@@ -10369,12 +10378,12 @@"sharp/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="],- "shiki-twoslash/@typescript/twoslash": ["@typescript/[email protected]", "", { "dependencies": { "@typescript/vfs": "1.3.5", "debug": "4.4.0", "lz-string": "1.5.0" } }, "sha512-kTwMUQ8xtAZaC4wb2XuLkPqFVBj2dNBueMQ89NWEuw87k2nLBbuafeG5cob/QEr6YduxIdTVUjix0MtC7mPlmg=="],-"shiki-twoslash/@typescript/vfs": ["@typescript/[email protected]", "", { "dependencies": { "debug": "4.4.0" } }, "sha512-RbyJiaAGQPIcAGWFa3jAXSuAexU4BFiDRF1g3hy7LmRqfNpYlTQWGXjcrOaVZjJ8YkkpuwG0FcsYvtWQpd9igQ=="],"shiki-twoslash/fenceparser": ["[email protected]", "", {}, "sha512-VdkTsK7GWLT0VWMK5S5WTAPn61wJ98WPFwJiRHumhg4ESNUO/tnkU8bzzzc62o6Uk1SVhuZFLnakmDA4SGV7wA=="],+ "shiki-twoslash/shiki": ["[email protected]", "", { "dependencies": { "jsonc-parser": "3.2.0", "vscode-oniguruma": "1.7.0", "vscode-textmate": "5.2.0" } }, "sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng=="],+"simple-swizzle/is-arrayish": ["[email protected]", "", {}, "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="],"sitemap/@types/node": ["@types/[email protected]", "", {}, "sha512-e8PUNQy1HgJGV3iU/Bp2+D/DXh3PYeyli8LgIwsQcs1Ar1LoaWHSIT6Rw+H2rNJmiq6SNWiDytfx8+gYj7wDHw=="],@@ -10577,7 +10586,7 @@"tunnel-rat/zustand": ["[email protected]", "", { "dependencies": { "use-sync-external-store": "1.2.2" }, "peerDependencies": { "@types/react": "19.0.0", "react": "19.0.0" }, "optionalPeers": ["@types/react", "react"] }, "sha512-+0PALYNJNgK6hldkgDq2vLrw5f6g/jCInz52n9RTpropGgeAf/ioFUCdtsjCqu4gNhW9D01rUQBROoRjdzyn2Q=="],- "twoslash/@typescript/vfs": ["@typescript/[email protected]", "", { "dependencies": { "debug": "4.4.1" }, "peerDependencies": { "typescript": "5.8.2" } }, "sha512-JwoxboBh7Oz1v38tPbkrZ62ZXNHAk9bJ7c9x0eI5zBfBnBYGhURdbnh7Z4smN/MV48Y5OCcZb58n972UtbazsA=="],+ "twoslash-cdn/twoslash": ["[email protected]", "", { "dependencies": { "@typescript/vfs": "1.6.1", "twoslash-protocol": "0.3.1" }, "peerDependencies": { "typescript": "5.8.2" } }, "sha512-OGqMTGvqXTcb92YQdwGfEdK0nZJA64Aj/ChLOelbl3TfYch2IoBST0Yx4C0LQ7Lzyqm9RpgcpgDxeXQIz4p2Kg=="],"typescript-eslint/@typescript-eslint/eslint-plugin": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@eslint-community/regexpp": "4.12.1", "@typescript-eslint/scope-manager": "8.21.0", "@typescript-eslint/type-utils": "8.21.0", "@typescript-eslint/utils": "8.21.0", "@typescript-eslint/visitor-keys": "8.21.0", "graphemer": "1.4.0", "ignore": "5.3.2", "natural-compare": "1.4.0", "ts-api-utils": "2.0.1" }, "peerDependencies": { "@typescript-eslint/parser": "8.21.0", "eslint": "9.19.0", "typescript": "5.7.3" } }, "sha512-eTH+UOR4I7WbdQnG4Z48ebIA6Bgi7WO8HvFEneeYBxG8qCOYgTOFPSg6ek9ITIDvGjDQzWHcoWHCDO2biByNzA=="],@@ -10813,6 +10822,18 @@"@algolia/autocomplete-shared/algoliasearch/@algolia/requester-node-http": ["@algolia/[email protected]", "", { "dependencies": { "@algolia/client-common": "5.18.0" } }, "sha512-tZCqDrqJ2YE2I5ukCQrYN8oiF6u3JIdCxrtKq+eniuLkjkO78TKRnXrVcKZTmfFJyyDK8q47SfDcHzAA3nHi6w=="],+ "@astrojs/markdown-remark/shiki/@shikijs/core": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0", "@shikijs/vscode-textmate": "10.0.2", "@types/hast": "3.0.4", "hast-util-to-html": "9.0.5" } }, "sha512-oJwU+DxGqp6lUZpvtQgVOXNZcVsirN76tihOLBmwILkKuRuwHteApP8oTXmL4tF5vS5FbOY0+8seXmiCoslk4g=="],++ "@astrojs/markdown-remark/shiki/@shikijs/engine-javascript": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0", "@shikijs/vscode-textmate": "10.0.2", "oniguruma-to-es": "4.3.3" } }, "sha512-6/ov6pxrSvew13k9ztIOnSBOytXeKs5kfIR7vbhdtVRg+KPzvp2HctYGeWkqv7V6YIoLicnig/QF3iajqyElZA=="],++ "@astrojs/markdown-remark/shiki/@shikijs/engine-oniguruma": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0", "@shikijs/vscode-textmate": "10.0.2" } }, "sha512-4DwIjIgETK04VneKbfOE4WNm4Q7WC1wo95wv82PoHKdqX4/9qLRUwrfKlmhf0gAuvT6GHy0uc7t9cailk6Tbhw=="],++ "@astrojs/markdown-remark/shiki/@shikijs/langs": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0" } }, "sha512-Njg/nFL4HDcf/ObxcK2VeyidIq61EeLmocrwTHGGpOQx0BzrPWM1j55XtKQ1LvvDWH15cjQy7rg96aJ1/l63uw=="],++ "@astrojs/markdown-remark/shiki/@shikijs/themes": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0" } }, "sha512-BhhWRzCTEk2CtWt4S4bgsOqPJRkapvxdsifAwqP+6mk5uxboAQchc0etiJ0iIasxnMsb764qGD24DK9albcU9Q=="],++ "@astrojs/markdown-remark/shiki/@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "10.0.2", "@types/hast": "3.0.4" } }, "sha512-RB7IMo2E7NZHyfkqAuaf4CofyY8bPzjWPjJRzn6SEak3b46fIQyG6Vx5fG/obqkfppQ+g8vEsiD7Uc6lqQt32Q=="],+"@astrojs/react/@vitejs/plugin-react/@babel/core": ["@babel/[email protected]", "", { "dependencies": { "@ampproject/remapping": "2.3.0", "@babel/code-frame": "7.26.2", "@babel/generator": "7.26.2", "@babel/helper-compilation-targets": "7.25.9", "@babel/helper-module-transforms": "7.26.0", "@babel/helpers": "7.26.0", "@babel/parser": "7.26.2", "@babel/template": "7.25.9", "@babel/traverse": "7.25.9", "@babel/types": "7.26.0", "convert-source-map": "2.0.0", "debug": "4.4.1", "gensync": "1.0.0-beta.2", "json5": "2.2.3", "semver": "6.3.1" } }, "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg=="],"@astrojs/react/@vitejs/plugin-react/@babel/plugin-transform-react-jsx-self": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "7.25.9" }, "peerDependencies": { "@babel/core": "7.26.0" } }, "sha512-y8quW6p0WHkEhmErnfe58r7x0A70uKphQm8Sp8cV7tjNQwK56sNVK0M73LK3WuYmsuyrftut4xAkjjgU0twaMg=="],@@ -12335,6 +12356,8 @@"@typescript-eslint/utils/eslint-scope/estraverse": ["[email protected]", "", {}, "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="],+ "@typescript/twoslash/@typescript/vfs/debug": ["[email protected]", "", { "dependencies": { "ms": "2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="],+"@vanilla-extract/babel-plugin-debug-ids/@babel/core/@babel/code-frame": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-validator-identifier": "7.27.1", "js-tokens": "4.0.0", "picocolors": "1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="],"@vanilla-extract/babel-plugin-debug-ids/@babel/core/@babel/generator": ["@babel/[email protected]", "", { "dependencies": { "@babel/parser": "7.27.5", "@babel/types": "7.27.6", "@jridgewell/gen-mapping": "0.3.5", "@jridgewell/trace-mapping": "0.3.25", "jsesc": "3.0.2" } }, "sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw=="],@@ -12495,6 +12518,18 @@"astro/sharp/detect-libc": ["[email protected]", "", {}, "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA=="],+ "astro/shiki/@shikijs/core": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0", "@shikijs/vscode-textmate": "10.0.2", "@types/hast": "3.0.4", "hast-util-to-html": "9.0.5" } }, "sha512-oJwU+DxGqp6lUZpvtQgVOXNZcVsirN76tihOLBmwILkKuRuwHteApP8oTXmL4tF5vS5FbOY0+8seXmiCoslk4g=="],++ "astro/shiki/@shikijs/engine-javascript": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0", "@shikijs/vscode-textmate": "10.0.2", "oniguruma-to-es": "4.3.3" } }, "sha512-6/ov6pxrSvew13k9ztIOnSBOytXeKs5kfIR7vbhdtVRg+KPzvp2HctYGeWkqv7V6YIoLicnig/QF3iajqyElZA=="],++ "astro/shiki/@shikijs/engine-oniguruma": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0", "@shikijs/vscode-textmate": "10.0.2" } }, "sha512-4DwIjIgETK04VneKbfOE4WNm4Q7WC1wo95wv82PoHKdqX4/9qLRUwrfKlmhf0gAuvT6GHy0uc7t9cailk6Tbhw=="],++ "astro/shiki/@shikijs/langs": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0" } }, "sha512-Njg/nFL4HDcf/ObxcK2VeyidIq61EeLmocrwTHGGpOQx0BzrPWM1j55XtKQ1LvvDWH15cjQy7rg96aJ1/l63uw=="],++ "astro/shiki/@shikijs/themes": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/types": "3.11.0" } }, "sha512-BhhWRzCTEk2CtWt4S4bgsOqPJRkapvxdsifAwqP+6mk5uxboAQchc0etiJ0iIasxnMsb764qGD24DK9albcU9Q=="],++ "astro/shiki/@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "10.0.2", "@types/hast": "3.0.4" } }, "sha512-RB7IMo2E7NZHyfkqAuaf4CofyY8bPzjWPjJRzn6SEak3b46fIQyG6Vx5fG/obqkfppQ+g8vEsiD7Uc6lqQt32Q=="],+"astro/vite/postcss": ["[email protected]", "", { "dependencies": { "nanoid": "3.3.11", "picocolors": "1.1.1", "source-map-js": "1.2.1" } }, "sha512-d/jtm+rdNT8tpXuHY5MMtcbJFBkhXE6593XVR9UoGCH8jSFGci7jGvMGH5RYd5PBJW+00NZQt6gf7CbagJCrhg=="],"autoprefixer/browserslist/electron-to-chromium": ["[email protected]", "", {}, "sha512-LxcRvnYO5ez2bMOFpbuuVuAI5QNeY1ncVytE/KXaL6ZNfzX1yPlAO0nSOyIHx2fVAuUprMqPs/TdVhUFZy7SIQ=="],@@ -13267,8 +13302,6 @@"remark-mdx/mdast-util-mdx/mdast-util-to-markdown": ["[email protected]", "", { "dependencies": { "@types/mdast": "3.0.10", "@types/unist": "2.0.6", "longest-streak": "3.1.0", "mdast-util-phrasing": "3.0.1", "mdast-util-to-string": "3.1.1", "micromark-util-decode-string": "1.0.2", "unist-util-visit": "4.1.2", "zwitch": "2.0.4" } }, "sha512-bbv7TPv/WC49thZPg3jXuqzuvI45IL2EVAr/KxF0BSdHsU0ceFHOmwQn6evxAh1GaoK/6GQ1wp4R4oW2+LFL/A=="],- "remark-shiki-twoslash/@typescript/twoslash/@typescript/vfs": ["@typescript/[email protected]", "", { "dependencies": { "debug": "4.4.1" } }, "sha512-pI8Saqjupf9MfLw7w2+og+fmb0fZS0J6vsKXXrp4/PDXEFvntgzXmChCXC/KefZZS0YGS6AT8e0hGAJcTsdJlg=="],-"remark-shiki-twoslash/unist-util-visit/unist-util-is": ["[email protected]", "", {}, "sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg=="],"remark-shiki-twoslash/unist-util-visit/unist-util-visit-parents": ["[email protected]", "", { "dependencies": { "@types/unist": "2.0.6", "unist-util-is": "4.1.0" } }, "sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg=="],@@ -13325,8 +13358,6 @@"serve-index/http-errors/statuses": ["[email protected]", "", {}, "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA=="],- "shiki-twoslash/@typescript/twoslash/@typescript/vfs": ["@typescript/[email protected]", "", { "dependencies": { "debug": "4.4.1" } }, "sha512-pI8Saqjupf9MfLw7w2+og+fmb0fZS0J6vsKXXrp4/PDXEFvntgzXmChCXC/KefZZS0YGS6AT8e0hGAJcTsdJlg=="],-"string-width/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA=="],"style-loader/webpack/@webassemblyjs/ast": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/helper-numbers": "1.11.6", "@webassemblyjs/helper-wasm-bytecode": "1.11.6" } }, "sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg=="],@@ -13719,7 +13750,9 @@"tunnel-rat/zustand/use-sync-external-store": ["[email protected]", "", { "peerDependencies": { "react": "19.0.0" } }, "sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw=="],- "twoslash/@typescript/vfs/debug": ["[email protected]", "", { "dependencies": { "ms": "2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="],+ "twoslash-cdn/twoslash/@typescript/vfs": ["@typescript/[email protected]", "", { "dependencies": { "debug": "4.4.1" }, "peerDependencies": { "typescript": "5.8.2" } }, "sha512-JwoxboBh7Oz1v38tPbkrZ62ZXNHAk9bJ7c9x0eI5zBfBnBYGhURdbnh7Z4smN/MV48Y5OCcZb58n972UtbazsA=="],++ "twoslash-cdn/twoslash/twoslash-protocol": ["[email protected]", "", {}, "sha512-BMePTL9OkuNISSyyMclBBhV2s9++DiOCyhhCoV5Kaht6eaWLwVjCCUJHY33eZJPsyKeZYS8Wzz0h+XI01VohVw=="],"typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/scope-manager": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.21.0", "@typescript-eslint/visitor-keys": "8.21.0" } }, "sha512-G3IBKz0/0IPfdeGRMbp+4rbjfSSdnGkXsM/pFZA8zM9t9klXDnB/YnKOBQ0GoPmoROa4bCq2NeHgJa5ydsQ4mA=="],@@ -13933,6 +13966,8 @@"yargs/string-width/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "6.0.1" } }, "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="],+ "@astrojs/markdown-remark/shiki/@shikijs/engine-javascript/oniguruma-to-es": ["[email protected]", "", { "dependencies": { "oniguruma-parser": "0.12.1", "regex": "6.0.1", "regex-recursion": "6.0.2" } }, "sha512-rPiZhzC3wXwE59YQMRDodUwwT9FZ9nNBwQQfsd1wfdtlKEyCdRV0avrTcSZ5xlIvGRVPd/cx6ZN45ECmS39xvg=="],+"@astrojs/react/@vitejs/plugin-react/@babel/core/@babel/parser": ["@babel/[email protected]", "", { "dependencies": { "@babel/types": "7.26.0" }, "bin": "./bin/babel-parser.js" }, "sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ=="],"@astrojs/react/@vitejs/plugin-react/@babel/core/@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "7.25.9", "@babel/helper-validator-identifier": "7.25.9" } }, "sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA=="],@@ -16187,6 +16222,8 @@"astro/sharp/@img/sharp-wasm32/@emnapi/runtime": ["@emnapi/[email protected]", "", { "dependencies": { "tslib": "2.8.1" } }, "sha512-97/BJ3iXHww3djw6hYIfErCZFee7qCtrneuLa20UXFCOTCfBM2cvQHjWJ2EG0s0MtdNwInarqCTz35i4wWXHsQ=="],+ "astro/shiki/@shikijs/engine-javascript/oniguruma-to-es": ["[email protected]", "", { "dependencies": { "oniguruma-parser": "0.12.1", "regex": "6.0.1", "regex-recursion": "6.0.2" } }, "sha512-rPiZhzC3wXwE59YQMRDodUwwT9FZ9nNBwQQfsd1wfdtlKEyCdRV0avrTcSZ5xlIvGRVPd/cx6ZN45ECmS39xvg=="],+"babel-loader/webpack/@webassemblyjs/ast/@webassemblyjs/helper-numbers": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.11.6", "@webassemblyjs/helper-api-error": "1.11.6", "@xtuc/long": "4.2.2" } }, "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g=="],"babel-loader/webpack/@webassemblyjs/ast/@webassemblyjs/helper-wasm-bytecode": ["@webassemblyjs/[email protected]", "", {}, "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA=="],@@ -16801,8 +16838,6 @@"remark-mdx/mdast-util-mdx/mdast-util-to-markdown/unist-util-visit": ["[email protected]", "", { "dependencies": { "@types/unist": "2.0.6", "unist-util-is": "5.2.0", "unist-util-visit-parents": "5.1.3" } }, "sha512-MSd8OUGISqHdVvfY9TPhyK2VdUrPgxkUtWSuMHF6XAAFuL4LokseigBnZtPnJMu+FbynTkFNnFlyjxpVKujMRg=="],- "remark-shiki-twoslash/@typescript/twoslash/@typescript/vfs/debug": ["[email protected]", "", { "dependencies": { "ms": "2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="],-"renderkid/css-select/domutils/dom-serializer": ["[email protected]", "", { "dependencies": { "domelementtype": "2.3.0", "domhandler": "4.3.1", "entities": "2.2.0" } }, "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig=="],"renderkid/htmlparser2/domutils/dom-serializer": ["[email protected]", "", { "dependencies": { "domelementtype": "2.3.0", "domhandler": "4.3.1", "entities": "2.2.0" } }, "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig=="],@@ -16845,8 +16880,6 @@"sass-loader/webpack/terser-webpack-plugin/serialize-javascript": ["[email protected]", "", { "dependencies": { "randombytes": "2.1.0" } }, "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w=="],- "shiki-twoslash/@typescript/twoslash/@typescript/vfs/debug": ["[email protected]", "", { "dependencies": { "ms": "2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="],-"style-loader/webpack/@webassemblyjs/ast/@webassemblyjs/helper-numbers": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.11.6", "@webassemblyjs/helper-api-error": "1.11.6", "@xtuc/long": "4.2.2" } }, "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g=="],"style-loader/webpack/@webassemblyjs/ast/@webassemblyjs/helper-wasm-bytecode": ["@webassemblyjs/[email protected]", "", {}, "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA=="],@@ -17195,6 +17228,8 @@"terser-webpack-plugin/schema-utils/ajv-keywords/ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "3.1.3", "json-schema-traverse": "1.0.0", "require-from-string": "2.0.2", "uri-js": "4.4.1" } }, "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg=="],+ "twoslash-cdn/twoslash/@typescript/vfs/debug": ["[email protected]", "", { "dependencies": { "ms": "2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="],+"typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/scope-manager/@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-PAL6LUuQwotLW2a8VsySDBwYMm129vFm4tMVlylzdoTybTHaAi0oBp7Ac6LhSrHHOdLM3efH+nAR6hAWoMF89A=="],"typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/type-utils/@typescript-eslint/typescript-estree": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.21.0", "@typescript-eslint/visitor-keys": "8.21.0", "debug": "4.4.1", "fast-glob": "3.3.2", "is-glob": "4.0.3", "minimatch": "9.0.5", "semver": "7.6.3", "ts-api-utils": "2.1.0" }, "peerDependencies": { "typescript": "5.7.3" } }, "sha512-x+aeKh/AjAArSauz0GiQZsjT8ciadNMHdkUSwBB9Z6PrKc/4knM4g3UfHml6oDJmKC88a6//cdxnO/+P2LkMcg=="],diff --git a/packages/docs/docs/maps.mdx b/packages/docs/docs/maps.mdxindex 245d98baed..d8165dde84 100644--- a/packages/docs/docs/maps.mdx+++ b/packages/docs/docs/maps.mdx@@ -182,7 +182,6 @@ const lineCoordinates = [[1, 1],];const progress = 0.5;-// @ts-expect-error (Only in docs, should work in your project)// ---cut---const routeLine = turf.lineString(lineCoordinates);const routeDistance = turf.length(routeLine);@@ -217,7 +216,6 @@ useEffect(() => {const handle = delayRender('Moving camera...');- // @ts-expect-error (Only in docs, should work in your project)const routeDistance = turf.length(turf.lineString(lineCoordinates));const progress = Math.max(@@ -227,7 +225,6 @@ useEffect(() => {}),);- // @ts-expect-error (Only in docs, should work in your project)const alongRoute = turf.along(turf.lineString(lineCoordinates), routeDistance * progress).geometry.coordinates;const camera = map.getFreeCameraOptions();diff --git a/packages/docs/docs/rive/remotionrivecanvas.mdx b/packages/docs/docs/rive/remotionrivecanvas.mdxindex 21623ca8a4..32cb3ab61e 100644--- a/packages/docs/docs/rive/remotionrivecanvas.mdx+++ b/packages/docs/docs/rive/remotionrivecanvas.mdx@@ -12,6 +12,7 @@ This component can render a [Rive](https://rive.app/) animation so it synchroniz## Example```tsx twoslash+import React from 'react';import {RemotionRiveCanvas} from '@remotion/rive';function App() {@@ -117,6 +118,7 @@ export const MyComp: React.FC = () => {You can attach a ref to the component to access the Rive Canvas instance.```tsx twoslash title="MyComp.tsx"+import React from 'react';import {RemotionRiveCanvas, RiveCanvasRef} from '@remotion/rive';import {useEffect} from 'react';diff --git a/packages/docs/docs/use-video-texture.mdx b/packages/docs/docs/use-video-texture.mdxindex ae4752f664..26c11f6a13 100644--- a/packages/docs/docs/use-video-texture.mdx+++ b/packages/docs/docs/use-video-texture.mdx@@ -30,6 +30,7 @@ const MyVideo = () => {To convert the video to a video texture, place the `useVideoTexture()` hook in the same component.```tsx twoslash+import React from 'react';const videoRef: React.MutableRefObject<HTMLVideoElement | null> = React.useRef(null);// ---cut---import {useVideoTexture} from '@remotion/three';@@ -42,6 +43,7 @@ const texture = useVideoTexture(videoRef);The return type of it is a `THREE.VideoTexture | null` which you can assign as a `map` to for example `meshBasicMaterial`. We recommend to only render the material when the texture is not `null` to prevent bugs.```tsx twoslash+import React from 'react';import {useVideoTexture} from '@remotion/three';const videoRef: React.MutableRefObject<HTMLVideoElement | null> = React.useRef(null);const videoTexture = useVideoTexture(videoRef);diff --git a/packages/docs/docusaurus-theme-shiki-twoslash/theme/CodeBlock/styles.css b/packages/docs/docusaurus-theme-shiki-twoslash/theme/CodeBlock/styles.cssindex 252717d9fa..a05bd93a49 100644--- a/packages/docs/docusaurus-theme-shiki-twoslash/theme/CodeBlock/styles.css+++ b/packages/docs/docusaurus-theme-shiki-twoslash/theme/CodeBlock/styles.css@@ -28,7 +28,7 @@ pre.shiki.with-title {padding-top: 2.5rem;}-/**+/*** Copy-to-Clipboard Button* Taken from https://github.com/facebook/docusaurus/blob/ed9d2a26f5a7b8096804ae1b3a4fffc504f8f90d/packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css* which is under MIT License as per the banner@@ -67,15 +67,21 @@ pre.shiki {padding: 0;}-/* Sets a horizontal padding for all the lines */-pre.shiki div.line,-pre.shiki div.meta-line {+/* Sets a horizontal padding for all the lines (shiki v3 uses span.line) */+pre.shiki .line,+pre.shiki .meta-line {padding-left: var(--ifm-pre-padding);padding-right: var(--ifm-pre-padding);font-family: monospace;}-/* Sets vertical padding for the container */+/* Sets vertical padding for the container β shiki v3 wraps in <code> directly */+pre.shiki > code {+ padding: var(--ifm-pre-padding) 0;+ display: block;+}++/* Also support old .code-container wrapper if rendererClassic produces it */pre.shiki > .code-container {padding: var(--ifm-pre-padding) 0;}@@ -89,7 +95,7 @@ pre.shiki {border-color: var(--ifm-color-emphasis-300);}-/* Hide language identifiers */+/* Hide language identifiers (kept for backwards compat, no longer generated in v3) */pre.shiki .language-id {display: none;}@@ -100,31 +106,31 @@ pre.shiki:hover .dim {filter: none;}-pre.shiki div.dim {+pre.shiki .dim {opacity: 0.5;filter: grayscale(1);transition: opacity 200ms ease-in-out;}-pre.shiki div.dim,-pre.shiki div.highlight {+pre.shiki .dim,+pre.shiki .highlight {margin: 0;/* To avoid flickering on the highlighted lines focus */border-left: 2px solid transparent;}-pre.shiki div.highlight {+pre.shiki .highlight {opacity: 1;transition: background-color 200ms ease-in-out;}-pre.shiki:hover div.highlight {+pre.shiki:hover .highlight {background-color: var(--ifm-hover-overlay);border-left: 2px solid var(--ifm-color-primary);width: 100%;}-pre.shiki div.line {+pre.shiki .line {min-height: 1rem;}@@ -176,11 +182,11 @@ pre .query {display: inline-block;}-/**+/*** In order to have the 'popped out' style design and to not break the layout* we need to place a fake and un-selectable copy of the error which _isn't_ broken out* behind the actual error message.- * This sections keeps both of those two in in sync+ * This sections keeps both of those two in in sync*/pre .error,@@ -292,8 +298,8 @@ data-lsp {@media (prefers-reduced-motion: reduce) {data-lsp,pre .code-container > a,- pre.shiki div.dim,- pre.shiki div.highlight {+ pre.shiki .dim,+ pre.shiki .highlight {transition: none;}}diff --git a/packages/docs/package.json b/packages/docs/package.jsonindex 33789cbbb8..65a7a3e963 100644--- a/packages/docs/package.json+++ b/packages/docs/package.json@@ -43,6 +43,9 @@"@remotion/cloudrun": "workspace:*","@remotion/design": "workspace:*","@remotion/docusaurus-plugin": "workspace:*",+ "shiki": "3.22.0",+ "@shikijs/twoslash": "3.22.0",+ "twoslash": "0.3.6","@remotion/enable-scss": "workspace:*","@remotion/eslint-config-internal": "workspace:*","@remotion/fonts": "workspace:*",diff --git a/packages/docs/prewarm-twoslash.ts b/packages/docs/prewarm-twoslash.tsindex f96ea9b29a..6925cfa8c8 100644--- a/packages/docs/prewarm-twoslash.ts+++ b/packages/docs/prewarm-twoslash.ts@@ -15,13 +15,16 @@ import {join, resolve} from 'path';const DOCS_ROOT = resolve(import.meta.dirname);const CACHE_ROOT = join(DOCS_ROOT, 'node_modules', '.cache', 'twoslash');-const WORKER_PATH = join(DOCS_ROOT, 'twoslash-worker.cjs');-const NUM_WORKERS = cpus().length;+const WORKER_PATH = join(DOCS_ROOT, 'twoslash-worker.ts');+const NUM_WORKERS = process.env.VERCEL+ ? cpus().length+ : Math.max(1, cpus().length - 2);const pluginDir = join(DOCS_ROOT, '..', 'docusaurus-plugin');const pluginRequire = createRequire(join(pluginDir, 'package.json'));-const shikiVersion = pluginRequire('@typescript/twoslash/package.json')+const twoslashVersion = pluginRequire('twoslash/package.json').version as string;+const shikiVersion = pluginRequire('shiki/package.json').version as string;const tsVersion = pluginRequire('typescript/package.json').version as string;interface TwoslashBlock {@@ -34,7 +37,9 @@ interface TwoslashBlock {function computeCachePath(code: string): string {const shasum = createHash('sha1');const codeSha = shasum- .update(`${code}-${shikiVersion}-${tsVersion}`)+ .update(+ `${code}-${twoslashVersion}-${shikiVersion}-${tsVersion}-github-dark`,+ ).digest('hex');return join(CACHE_ROOT, `${codeSha}.json`);}@@ -155,7 +160,7 @@ function runWorker(const tmpFile = join(DOCS_ROOT, `.twoslash-work-${workerId}.json`);writeFileSync(tmpFile, JSON.stringify(workItems));- const child = spawn('node', [WORKER_PATH, tmpFile], {+ const child = spawn('bun', ['run', WORKER_PATH, tmpFile], {cwd: DOCS_ROOT,stdio: ['ignore', 'pipe', 'pipe'],});@@ -294,6 +299,15 @@ async function main() {allTimings.sort((a, b) => b.ms - a.ms);console.log(`\nTwoslash pre-warm: ${totalCompleted} blocks in ${totalTime}s using ${numWorkers} workers (${totalErrors} errors)`);+ const errorTimings = allTimings.filter((t) => t.error);+ if (errorTimings.length > 0) {+ console.log(`\nErrors:`);+ for (const t of errorTimings) {+ const files = t.sourceFiles.join(', ');+ console.log(` ${t.ms}ms - ${files} ERROR: ${t.error}`);+ }+ }+console.log(`\nSlowest snippets:`);for (const t of allTimings.slice(0, 30)) {const files = t.sourceFiles.join(', ');diff --git a/packages/docs/twoslash-worker.cjs b/packages/docs/twoslash-worker.cjsdeleted file mode 100644index e015ff252c..0000000000--- a/packages/docs/twoslash-worker.cjs+++ /dev/null@@ -1,66 +0,0 @@-const {createRequire} = require('module');-const {writeFileSync, existsSync, mkdirSync, readFileSync} = require('fs');-const {dirname, join} = require('path');--// Resolve from the docusaurus-plugin which has these as dependencies-const pluginDir = join(__dirname, '..', 'docusaurus-plugin');-const pluginRequire = createRequire(join(pluginDir, 'package.json'));-const {runTwoSlash} = pluginRequire('shiki-twoslash');-const {ScriptTarget, ModuleKind} = pluginRequire('typescript');--const settings = {- defaultCompilerOptions: {- types: ['node'],- target: ScriptTarget.ESNext,- module: ModuleKind.ESNext,- },-};--// Read work items from the file passed as argument-const workFile = process.argv[2];-const items = JSON.parse(readFileSync(workFile, 'utf8'));--let completed = 0;-let errors = 0;-const timings = [];--for (const item of items) {- const start = performance.now();- try {- const results = runTwoSlash(item.code, item.lang, settings);- const dir = dirname(item.cachePath);- if (!existsSync(dir)) mkdirSync(dir, {recursive: true});- writeFileSync(item.cachePath, JSON.stringify(results), 'utf8');- completed++;- timings.push({- cachePath: item.cachePath,- ms: Math.round(performance.now() - start),- });- } catch (error) {- errors++;- timings.push({- cachePath: item.cachePath,- ms: Math.round(performance.now() - start),- error: error.message.slice(0, 200),- });- }-- // Report progress every 10 items- if ((completed + errors) % 10 === 0) {- process.stdout.write(- JSON.stringify({completed, errors, total: items.length, timings}) +- '\n',- );- }-}--// Final report-process.stdout.write(- JSON.stringify({- completed,- errors,- total: items.length,- done: true,- timings,- }) + '\n',-);diff --git a/packages/docs/twoslash-worker.ts b/packages/docs/twoslash-worker.tsnew file mode 100644index 0000000000..ec64e6b745--- /dev/null+++ b/packages/docs/twoslash-worker.ts@@ -0,0 +1,90 @@+import {rendererClassic, transformerTwoslash} from '@shikijs/twoslash';+import {existsSync, mkdirSync, readFileSync, writeFileSync} from 'fs';+import {dirname} from 'path';+import {createHighlighter} from 'shiki';+import {createTwoslasher} from 'twoslash';++interface WorkItem {+ code: string;+ lang: string;+ cachePath: string;+}++// Read work items from the file passed as argument+const workFile = process.argv[2];+const items: WorkItem[] = JSON.parse(readFileSync(workFile, 'utf8'));++// Create Language Service ONCE per worker (5-20x faster for batch)+const twoslasher = createTwoslasher({+ compilerOptions: {+ types: ['node'],+ target: 99 /* ESNext */,+ module: 99 /* ESNext */,+ jsx: 4 /* ReactJSX */,+ },+});++// Collect unique languages from work items+const uniqueLangs = [...new Set(items.map((item) => item.lang))];++// Create highlighter ONCE with all needed languages+const highlighter = await createHighlighter({+ themes: ['github-dark'],+ langs: uniqueLangs,+});++let completed = 0;+let errors = 0;+const timings: Array<{cachePath: string; ms: number; error?: string}> = [];++for (const item of items) {+ const start = performance.now();+ try {+ const html = highlighter.codeToHtml(item.code, {+ lang: item.lang,+ theme: 'github-dark',+ transformers: [+ transformerTwoslash({+ twoslasher,+ renderer: rendererClassic(),+ explicitTrigger: false,+ }),+ ],+ });++ const dir = dirname(item.cachePath);+ if (!existsSync(dir)) mkdirSync(dir, {recursive: true});+ writeFileSync(item.cachePath, html, 'utf8');+ completed++;+ timings.push({+ cachePath: item.cachePath,+ ms: Math.round(performance.now() - start),+ });+ } catch (error) {+ errors++;+ timings.push({+ cachePath: item.cachePath,+ ms: Math.round(performance.now() - start),+ error: (error as Error).message.slice(0, 200),+ });+ }++ // Report progress every 10 items+ if ((completed + errors) % 10 === 0) {+ process.stdout.write(+ JSON.stringify({completed, errors, total: items.length, timings}) ++ '\n',+ );+ }+}++// Final report+process.stdout.write(+ JSON.stringify({+ completed,+ errors,+ total: items.length,+ done: true,+ timings,+ }) + '\n',+);diff --git a/packages/docusaurus-plugin/package.json b/packages/docusaurus-plugin/package.jsonindex 94ac49492c..ff4948b817 100644--- a/packages/docusaurus-plugin/package.json+++ b/packages/docusaurus-plugin/package.json@@ -14,12 +14,12 @@"url": "https://github.com/remotion-dev/remotion/issues"},"dependencies": {- "shiki-twoslash": "3.1.2",+ "shiki": "3.22.0",+ "@shikijs/twoslash": "3.22.0",+ "twoslash": "0.3.6","unified": "^11.0.5","unist-util-visit": "^5.0.0","fenceparser": "^2.2.0",- "shiki": "0.10.1",- "@typescript/twoslash": "3.2.1","@docusaurus/types": "3.6.0","@types/dom-webcodecs": "catalog:"},diff --git a/packages/docusaurus-plugin/src/caching.ts b/packages/docusaurus-plugin/src/caching.tsindex bd1f8f66aa..ecc4e9d58a 100644--- a/packages/docusaurus-plugin/src/caching.ts+++ b/packages/docusaurus-plugin/src/caching.ts@@ -1,29 +1,66 @@/* eslint-disable no-console */-import type {TwoSlashReturn} from '@typescript/twoslash';-import type {UserConfigSettings} from 'shiki-twoslash';-import {runTwoSlash} from 'shiki-twoslash';-import {ModuleKind, ScriptTarget} from 'typescript';+import {rendererClassic, transformerTwoslash} from '@shikijs/twoslash';+import type {HighlighterGeneric} from 'shiki/core';+import {createTwoslasher} from 'twoslash';++let cachedTwoslasher: ReturnType<typeof createTwoslasher> | null = null;++function getTwoslasher() {+ if (!cachedTwoslasher) {+ cachedTwoslasher = createTwoslasher({+ compilerOptions: {+ types: ['node'],+ target: 99 /* ESNext */,+ module: 99 /* ESNext */,+ jsx: 4 /* ReactJSX */,+ },+ });+ }++ return cachedTwoslasher;+}/**- * Keeps a cache of the JSON responses to a twoslash call in node_modules/.cache/twoslash- * which should keep CI times down (e.g. the epub vs the handbook etc) - but also during- * dev time, where it can be super useful.+ * Keeps a cache of the HTML responses in node_modules/.cache/twoslash+ * which should keep CI times down β but also during dev time.+ * Returns an HTML string (final rendered output).*/export const cachedTwoslashCall = (code: string,lang: string,- settings: UserConfigSettings,-): TwoSlashReturn => {+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ highlighter: HighlighterGeneric<any, any>,+): string => {const {createHash} = require('crypto');const {readFileSync, existsSync, mkdirSync, writeFileSync} = require('fs');const {join} = require('path');- const shikiVersion = require('@typescript/twoslash/package.json').version;- const tsVersion = require('typescript/package.json').version;+ const {createRequire} = require('module');+ const _require = createRequire(__filename);+ const readPkgVersion = (pkg: string) => {+ const entryPath = _require.resolve(pkg);+ let dir = require('path').dirname(entryPath);+ while (dir !== '/') {+ const p = join(dir, 'package.json');+ if (existsSync(p)) {+ return JSON.parse(readFileSync(p, 'utf8')).version as string;+ }++ dir = require('path').dirname(dir);+ }++ return 'unknown';+ };++ const twoslashVersion = readPkgVersion('twoslash');+ const shikiVersion = readPkgVersion('shiki');+ const tsVersion = readPkgVersion('typescript');const shasum = createHash('sha1');const codeSha = shasum- .update(`${code}-${shikiVersion}-${tsVersion}`)+ .update(+ `${code}-${twoslashVersion}-${shikiVersion}-${tsVersion}-github-dark`,+ ).digest('hex');const getNmCache = () => {@@ -32,25 +69,30 @@ export const cachedTwoslashCall = (};const cacheRoot = getNmCache();-const cachePath = join(cacheRoot, `${codeSha}.json`);if (existsSync(cachePath)) {if (process.env.debug)console.log(`Using cached twoslash results from ${cachePath}`);- return JSON.parse(readFileSync(cachePath, 'utf8'));+ return readFileSync(cachePath, 'utf8');}- const results = runTwoSlash(code, lang, {- ...settings,- defaultCompilerOptions: {- ...settings.defaultCompilerOptions,- target: ScriptTarget.ESNext,- module: ModuleKind.ESNext,- },+ const twoslasher = getTwoslasher();++ const html = highlighter.codeToHtml(code, {+ lang,+ theme: 'github-dark',+ transformers: [+ transformerTwoslash({+ twoslasher,+ renderer: rendererClassic(),+ explicitTrigger: false,+ }),+ ],});+if (!existsSync(cacheRoot)) mkdirSync(cacheRoot, {recursive: true});- writeFileSync(cachePath, JSON.stringify(results), 'utf8');- return results;+ writeFileSync(cachePath, html, 'utf8');+ return html;};diff --git a/packages/docusaurus-plugin/src/exceptionMessageDOM.ts b/packages/docusaurus-plugin/src/exceptionMessageDOM.tsindex 8b9ba1cde3..3f640b0e37 100644--- a/packages/docusaurus-plugin/src/exceptionMessageDOM.ts+++ b/packages/docusaurus-plugin/src/exceptionMessageDOM.ts@@ -1,5 +1,4 @@/* eslint-disable no-console */-import {TwoslashError} from '@typescript/twoslash';import type {Node} from './unist-types';export function escapeHtml(html: string) {@@ -89,7 +88,23 @@ export const setupNodeForTwoslashException = (}</style>`;- const bodyFromTwoslashError = (err: TwoslashError) => {+ const isTwoslashError = (+ err: unknown,+ ): err is {title: string; description: string; recommendation: string} => {+ return (+ typeof err === 'object' &&+ err !== null &&+ 'title' in err &&+ 'description' in err &&+ 'recommendation' in err+ );+ };++ const bodyFromTwoslashError = (err: {+ title: string;+ description: string;+ recommendation: string;+ }) => {return `<h3>${escapeHtml(err.title)}</h3><p>${escapeHtml(err.description).replace(/(?:\r\n|\r|\n)/g, '<br>')}</p>@@ -124,7 +139,7 @@ export const setupNodeForTwoslashException = (body = String(error);eLog(`### Unexpected error:`);eLog(error);- } else if (error instanceof TwoslashError) {+ } else if (isTwoslashError(error)) {body = bodyFromTwoslashError(error);eLog(`### Twoslash error: ${error.title}`);eLog(error.description);diff --git a/packages/docusaurus-plugin/src/shiki.ts b/packages/docusaurus-plugin/src/shiki.tsindex 35cf5652a6..b467c3fbc3 100644--- a/packages/docusaurus-plugin/src/shiki.ts+++ b/packages/docusaurus-plugin/src/shiki.ts@@ -1,10 +1,6 @@-import {TwoslashError} from '@typescript/twoslash';-import {lex, parse} from 'fenceparser';-import type {Highlighter} from 'shiki';-import {getHighlighter} from 'shiki';-import type {UserConfigSettings} from 'shiki-twoslash';-import {renderCodeToHTML} from 'shiki-twoslash';+import type {BundledLanguage, BundledTheme, HighlighterGeneric} from 'shiki';+import {createHighlighter} from 'shiki';import type {BuildVisitor} from 'unist-util-visit';import {visit} from 'unist-util-visit';import {cachedTwoslashCall} from './caching';@@ -20,116 +16,18 @@ type Fence = {meta: OBJECT;};-// A set of includes which can be pulled via a set ID-const includes = new Map<string, string>();--function getHTML({- code,- fence,- highlighters,- twoslash,- twoslashSettings,-}: {- code: string;- fence: Fence;- highlighters: Highlighter[];- twoslash: any;- twoslashSettings: UserConfigSettings;-}) {- // Shiki doesn't respect json5 as an input, so switch it- // to json, which can handle comments in the syntax highlight- if (fence.lang === 'json5') {- fence.lang = 'json';- }-- let results;- // Support 'twoslash' includes- if (fence.lang === 'twoslash') {- if (!fence.meta.include || typeof fence.meta.include !== 'string') {- throw new Error(- "A twoslash code block needs a pragma like 'twoslash include [name]'",- );- }-- addIncludes(includes, fence.meta.include, code);- results = twoslashSettings.wrapFragments- ? `<div class="shiki-twoslash-fragment"></div>`- : '';- } else {- // All good, get each highlighter and render the shiki output for it- const output = highlighters.map((highlighter) => {- // @ts-expect-error- const themeName = highlighter.customName- .split('/')- .pop()- .replace('.json', '');- const html = renderCodeToHTML(- code,- fence.lang,- fence.meta as any,- {themeName, ...twoslashSettings},- highlighter,- twoslash,- );- return html.replace(- '</pre>',- '<button class="copy-button" aria-label="Copy code to clipboard">Copy</button></pre>',- );- });- results = output.join('\n');- if (highlighters.length > 1 && twoslashSettings.wrapFragments) {- results = `<div class="shiki-twoslash-fragment">${results}</div>`;- }- }-- return results;+interface TwoslashSettings {+ themes?: string[];+ theme?: string;+ wrapFragments?: boolean;+ ignoreCodeblocksWithCodefenceMeta?: string[];+ alwayRaiseForTwoslashExceptions?: boolean;+ defaultCompilerOptions?: Record<string, unknown>;+ [key: string]: unknown;}-/**- * Runs twoslash across an AST node, switching out the text content, and lang- * and adding a `twoslash` property to the node.- */-export const runTwoSlashOnNode = (- code: string,- {lang, meta}: {lang: string; meta: Record<string, unknown>},- settings = {},-) => {- // Only run twoslash when the meta has the attribute twoslash- if (meta.twoslash) {- const importedCode = replaceIncludesInCode(includes, code);- return cachedTwoslashCall(importedCode, lang, settings);- }-- return undefined;-};--// To make sure we only have one highlighter per theme in a process-const highlighterCache = new Map();--/** Sets up the highlighters, and cache's for recalls */-export const highlightersFromSettings = (- settings: UserConfigSettings,-): Promise<Highlighter[]> => {- // console.log("i should only log once per theme")- // ^ uncomment this to debug if required- const themes =- settings.themes || (settings.theme ? [settings.theme] : ['dark-plus']);-- return Promise.all(- themes.map(async (theme) => {- // You can put a string, a path, or the JSON theme obj- const themeName = typeof theme === 'string' ? theme : theme.name;- const highlighter = await getHighlighter({- ...settings,- theme,- themes: undefined,- });- // @ts-expect-error- highlighter.customName = themeName;- return highlighter;- }),- );-};+// A set of includes which can be pulled via a set ID+const includes = new Map<string, string>();const parsingNewFile = () => includes.clear();@@ -155,6 +53,51 @@ const parseFence = (fence: string): Fence => {};};+// To make sure we only have one highlighter per settings in a process+const highlighterCache = new Map<+ TwoslashSettings,+ Promise<HighlighterGeneric<BundledLanguage, BundledTheme>>+>();++const ALL_LANGS: BundledLanguage[] = [+ 'tsx',+ 'typescript',+ 'jsx',+ 'javascript',+ 'json',+ 'bash',+ 'shellscript',+ 'css',+ 'html',+ 'diff',+ 'yaml',+ 'toml',+ 'docker',+ 'python',+ 'ruby',+ 'go',+ 'php',+ 'markdown',+ 'ini',+];++/** Creates a highlighter and caches for reuse */+const getHighlighterInstance = (+ settings: TwoslashSettings,+): Promise<HighlighterGeneric<BundledLanguage, BundledTheme>> => {+ if (!highlighterCache.has(settings)) {+ highlighterCache.set(+ settings,+ createHighlighter({+ themes: ['github-dark'],+ langs: ALL_LANGS,+ }),+ );+ }++ return highlighterCache.get(settings)!;+};+// --- The Remark API ---/**@@ -162,23 +105,21 @@ const parseFence = (fence: string): Fence => {*/const remarkVisitor =(- highlighters: Highlighter[],- twoslashSettings: UserConfigSettings = {},+ highlighter: HighlighterGeneric<BundledLanguage, BundledTheme>,+ twoslashSettings: TwoslashSettings = {},): BuildVisitor<Node, 'code' | 'html'> =>(node: Node) => {const code = node;- let fence;+ let fence: Fence;try {fence = parseFence([node.lang, node.meta].filter(Boolean).join(' '));} catch {- const twoslashError = new TwoslashError(- 'Codefence error',- 'Could not parse the codefence for this code sample',- "It's usually an unclosed string",+ return setupNodeForTwoslashException(code.value,+ node,+ new Error('Could not parse the codefence for this code sample'),);- return setupNodeForTwoslashException(code.value, node, twoslashError);}// Do nothing if the node has an attribute to ignore@@ -192,40 +133,81 @@ const remarkVisitor =return;}- let twoslash;- try {- // By allowing node.twoslash to already exist you can set it up yourself in a browser- twoslash =- node.twoslash || runTwoSlashOnNode(code.value, fence, twoslashSettings);- } catch (error) {- const shouldAlwaysRaise =- process && process.env && Boolean(process.env.CI);- // @ts-expect-error- const yeahButNotInTests = typeof jest === 'undefined';+ let shikiHTML: string;- if (- (shouldAlwaysRaise && yeahButNotInTests) ||- twoslashSettings.alwayRaiseForTwoslashExceptions- ) {- throw error;- } else {- return setupNodeForTwoslashException(code.value, node, error as Error);+ if (fence.lang === 'twoslash') {+ // Support 'twoslash' includes+ if (!fence.meta.include || typeof fence.meta.include !== 'string') {+ throw new Error(+ "A twoslash code block needs a pragma like 'twoslash include [name]'",+ );}- }- if (twoslash) {- node.value = twoslash.code;- node.lang = twoslash.extension;- node.twoslash = twoslash;- }+ addIncludes(includes, fence.meta.include, node.value);+ shikiHTML = twoslashSettings.wrapFragments+ ? `<div class="shiki-twoslash-fragment"></div>`+ : '';+ } else if (fence.meta.twoslash) {+ // Twoslash code block β use cached call+ const importedCode = replaceIncludesInCode(includes, node.value);+ try {+ shikiHTML = cachedTwoslashCall(importedCode, fence.lang, highlighter);+ } catch (error) {+ const shouldAlwaysRaise =+ process && process.env && Boolean(process.env.CI);++ if (+ shouldAlwaysRaise ||+ twoslashSettings.alwayRaiseForTwoslashExceptions+ ) {+ throw error;+ } else {+ return setupNodeForTwoslashException(+ code.value,+ node,+ error as Error,+ );+ }+ }++ // Add copy button+ shikiHTML = shikiHTML.replace(+ '</pre>',+ '<button class="copy-button" aria-label="Copy code to clipboard">Copy</button></pre>',+ );+ } else {+ // Regular (non-twoslash) code block+ const langAliases: Record<string, string> = {+ json5: 'json',+ js: 'javascript',+ ts: 'typescript',+ sh: 'bash',+ rb: 'ruby',+ md: 'markdown',+ txt: 'plaintext',+ };+ const resolvedLang =+ langAliases[fence.lang] || fence.lang || 'plaintext';++ try {+ shikiHTML = highlighter.codeToHtml(node.value, {+ lang: resolvedLang,+ theme: 'github-dark',+ });+ } catch {+ // Fallback: if language is not supported, render as plaintext+ shikiHTML = highlighter.codeToHtml(node.value, {+ lang: 'plaintext',+ theme: 'github-dark',+ });+ }- const shikiHTML = getHTML({- code: node.value,- fence,- highlighters,- twoslash,- twoslashSettings,- });+ // Add copy button+ shikiHTML = shikiHTML.replace(+ '</pre>',+ '<button class="copy-button" aria-label="Copy code to clipboard">Copy</button></pre>',+ );+ }// @ts-expect-errornode.type = 'mdxJsxFlowElement';@@ -323,39 +305,12 @@ const remarkVisitor =* Synchronous outer function, async inner function, which is how the remark* async API works.*/-export function remarkTwoslash(settings: UserConfigSettings = {}) {- if (!highlighterCache.has(settings)) {- highlighterCache.set(settings, highlightersFromSettings(settings));- }-+export function remarkTwoslash(settings: TwoslashSettings = {}) {const transform = async (markdownAST: Node) => {- const highlighters = await highlighterCache.get(settings);+ const highlighter = await getHighlighterInstance(settings);parsingNewFile();- visit(markdownAST, 'code', remarkVisitor(highlighters, settings));+ visit(markdownAST, 'code', remarkVisitor(highlighter, settings));};return transform;}--// --- The Markdown-it API -----/** Only the inner function exposed as a synchronous API for markdown-it */--export const transformAttributesToHTML = (- code: string,- fenceString: string,- highlighters: Highlighter[],- settings: UserConfigSettings,-) => {- const fence = parseFence(fenceString);-- const twoslash = runTwoSlashOnNode(code, fence, settings);- const newCode = (twoslash && twoslash.code) || code;- return getHTML({- code: newCode,- fence,- highlighters,- twoslash,- twoslashSettings: settings,- });-};diff --git a/packages/docusaurus-plugin/src/unist-types.ts b/packages/docusaurus-plugin/src/unist-types.tsindex fe4e489277..bda2c87606 100644--- a/packages/docusaurus-plugin/src/unist-types.ts+++ b/packages/docusaurus-plugin/src/unist-types.ts@@ -1,7 +1,5 @@// ## Interfaces-import type {TwoSlashReturn} from '@typescript/twoslash';-/*** Info associated with nodes by the ecosystem.*@@ -108,7 +106,7 @@ export interface Node {lang: string;meta?: string;children?: Node[];- twoslash?: TwoSlashReturn;+ twoslash?: unknown;}/**