From 8c65dd4b5d44746cc7fc9789c780abdcaa474efa Mon Sep 17 00:00:00 2001 From: Vordgi Date: Tue, 15 Oct 2024 22:09:30 +0400 Subject: [PATCH 1/4] rd-314 install next --- packages/robindoc/package.json | 2 + pnpm-lock.yaml | 215 +++++++++++++++++++++++++++++++++ 2 files changed, 217 insertions(+) diff --git a/packages/robindoc/package.json b/packages/robindoc/package.json index eacf40ae..5b5bf09d 100644 --- a/packages/robindoc/package.json +++ b/packages/robindoc/package.json @@ -43,6 +43,7 @@ "@types/node": "20.12.11", "@types/react": "18.3.3", "@types/react-dom": "18.3.0", + "next": "14.2.15", "react": "18.3.1", "react-dom": "18.3.1", "rollup": "4.24.0", @@ -54,6 +55,7 @@ "typescript-transform-paths": "3.5.1" }, "peerDependencies": { + "next": ">= 13.0.0", "react": ">= 18.3.0", "react-dom": ">= 18.3.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9cc588e8..ad1db51c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -75,6 +75,9 @@ importers: '@types/react-dom': specifier: 18.3.0 version: 18.3.0 + next: + specifier: 14.2.15 + version: 14.2.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8) react: specifier: 18.3.1 version: 18.3.1 @@ -161,6 +164,63 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + '@next/env@14.2.15': + resolution: {integrity: sha512-S1qaj25Wru2dUpcIZMjxeMVSwkt8BK4dmWHHiBuRstcIyOsMapqT4A4jSB6onvqeygkSSmOkyny9VVx8JIGamQ==} + + '@next/swc-darwin-arm64@14.2.15': + resolution: {integrity: sha512-Rvh7KU9hOUBnZ9TJ28n2Oa7dD9cvDBKua9IKx7cfQQ0GoYUwg9ig31O2oMwH3wm+pE3IkAQ67ZobPfEgurPZIA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + + '@next/swc-darwin-x64@14.2.15': + resolution: {integrity: sha512-5TGyjFcf8ampZP3e+FyCax5zFVHi+Oe7sZyaKOngsqyaNEpOgkKB3sqmymkZfowy3ufGA/tUgDPPxpQx931lHg==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + + '@next/swc-linux-arm64-gnu@14.2.15': + resolution: {integrity: sha512-3Bwv4oc08ONiQ3FiOLKT72Q+ndEMyLNsc/D3qnLMbtUYTQAmkx9E/JRu0DBpHxNddBmNT5hxz1mYBphJ3mfrrw==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + + '@next/swc-linux-arm64-musl@14.2.15': + resolution: {integrity: sha512-k5xf/tg1FBv/M4CMd8S+JL3uV9BnnRmoe7F+GWC3DxkTCD9aewFRH1s5rJ1zkzDa+Do4zyN8qD0N8c84Hu96FQ==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + + '@next/swc-linux-x64-gnu@14.2.15': + resolution: {integrity: sha512-kE6q38hbrRbKEkkVn62reLXhThLRh6/TvgSP56GkFNhU22TbIrQDEMrO7j0IcQHcew2wfykq8lZyHFabz0oBrA==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + + '@next/swc-linux-x64-musl@14.2.15': + resolution: {integrity: sha512-PZ5YE9ouy/IdO7QVJeIcyLn/Rc4ml9M2G4y3kCM9MNf1YKvFY4heg3pVa/jQbMro+tP6yc4G2o9LjAz1zxD7tQ==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + + '@next/swc-win32-arm64-msvc@14.2.15': + resolution: {integrity: sha512-2raR16703kBvYEQD9HNLyb0/394yfqzmIeyp2nDzcPV4yPjqNUG3ohX6jX00WryXz6s1FXpVhsCo3i+g4RUX+g==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [win32] + + '@next/swc-win32-ia32-msvc@14.2.15': + resolution: {integrity: sha512-fyTE8cklgkyR1p03kJa5zXEaZ9El+kDNM5A+66+8evQS5e/6v0Gk28LqA0Jet8gKSOyP+OTm/tJHzMlGdQerdQ==} + engines: {node: '>= 10'} + cpu: [ia32] + os: [win32] + + '@next/swc-win32-x64-msvc@14.2.15': + resolution: {integrity: sha512-SzqGbsLsP9OwKNUG9nekShTwhj6JSB9ZLMWQ8g1gG6hdE5gQLncbnbymrwy2yVmH9nikSLYRYxYMFu78Ggp7/g==} + engines: {node: '>= 10'} + cpu: [x64] + os: [win32] + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -316,6 +376,12 @@ packages: '@shikijs/vscode-textmate@9.2.2': resolution: {integrity: sha512-TMp15K+GGYrWlZM8+Lnj9EaHEFmOen0WJBrfa17hF7taDOYthuPPV0GWzfd/9iMij0akS/8Yw2ikquH7uVi/fg==} + '@swc/counter@0.1.3': + resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} + + '@swc/helpers@0.5.5': + resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==} + '@types/eslint@9.6.0': resolution: {integrity: sha512-gi6WQJ7cHRgZxtkQEoyHMppPjq9Kxo5Tjn2prSKDSmZrCz8TZ3jSRCeTJm+WoM+oB0WG37bRqLzaaU3q7JypGg==} @@ -479,10 +545,17 @@ packages: buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + busboy@1.6.0: + resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} + engines: {node: '>=10.16.0'} + callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} + caniuse-lite@1.0.30001668: + resolution: {integrity: sha512-nWLrdxqCdblixUO+27JtGJJE/txpJlyUy5YN1u53wLZkP0emYCo5zgS6QYft7VUYR42LGgi/S5hdLZTrnyIddw==} + ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} @@ -500,6 +573,9 @@ packages: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} + client-only@0.0.1: + resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==} + clsx@2.1.1: resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} engines: {node: '>=6'} @@ -748,6 +824,9 @@ packages: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} @@ -973,9 +1052,32 @@ packages: ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + next@14.2.15: + resolution: {integrity: sha512-h9ctmOokpoDphRvMGnwOJAedT6zKhwqyZML9mDtspgf4Rh3Pn7UTYKqePNoDvhsWBAO5GoPNYshnAUGIazVGmw==} + engines: {node: '>=18.17.0'} + hasBin: true + peerDependencies: + '@opentelemetry/api': ^1.1.0 + '@playwright/test': ^1.41.2 + react: ^18.2.0 + react-dom: ^18.2.0 + sass: ^1.3.0 + peerDependenciesMeta: + '@opentelemetry/api': + optional: true + '@playwright/test': + optional: true + sass: + optional: true + normalize-path@3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -1032,10 +1134,17 @@ packages: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} + picocolors@1.1.0: + resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + postcss@8.4.31: + resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} + engines: {node: ^10 || ^12 || >=14} + prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -1179,6 +1288,10 @@ packages: sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + streamsearch@1.1.0: + resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} + engines: {node: '>=10.0.0'} + string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -1212,6 +1325,19 @@ packages: style-to-object@1.0.6: resolution: {integrity: sha512-khxq+Qm3xEyZfKd/y9L3oIWQimxuc4STrQKtQn8aSDRHb8mFgpukgX1hdzfrMEW6JCjyJ8p89x+IUMVnCBI1PA==} + styled-jsx@5.1.1: + resolution: {integrity: sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==} + engines: {node: '>= 12.0.0'} + peerDependencies: + '@babel/core': '*' + babel-plugin-macros: '*' + react: '>= 16.8.0 || 17.x.x || ^18.0.0-0' + peerDependenciesMeta: + '@babel/core': + optional: true + babel-plugin-macros: + optional: true + supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} @@ -1406,6 +1532,35 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 + '@next/env@14.2.15': {} + + '@next/swc-darwin-arm64@14.2.15': + optional: true + + '@next/swc-darwin-x64@14.2.15': + optional: true + + '@next/swc-linux-arm64-gnu@14.2.15': + optional: true + + '@next/swc-linux-arm64-musl@14.2.15': + optional: true + + '@next/swc-linux-x64-gnu@14.2.15': + optional: true + + '@next/swc-linux-x64-musl@14.2.15': + optional: true + + '@next/swc-win32-arm64-msvc@14.2.15': + optional: true + + '@next/swc-win32-ia32-msvc@14.2.15': + optional: true + + '@next/swc-win32-x64-msvc@14.2.15': + optional: true + '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -1534,6 +1689,13 @@ snapshots: '@shikijs/vscode-textmate@9.2.2': {} + '@swc/counter@0.1.3': {} + + '@swc/helpers@0.5.5': + dependencies: + '@swc/counter': 0.1.3 + tslib: 2.6.3 + '@types/eslint@9.6.0': dependencies: '@types/estree': 1.0.6 @@ -1718,8 +1880,14 @@ snapshots: buffer-from@1.1.2: {} + busboy@1.6.0: + dependencies: + streamsearch: 1.1.0 + callsites@3.1.0: {} + caniuse-lite@1.0.30001668: {} + ccount@2.0.1: {} chalk@4.1.2: @@ -1743,6 +1911,8 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + client-only@0.0.1: {} + clsx@2.1.1: {} color-convert@2.0.1: @@ -2020,6 +2190,8 @@ snapshots: merge2: 1.4.1 slash: 3.0.0 + graceful-fs@4.2.11: {} + graphemer@1.4.0: {} gray-matter@4.0.3: @@ -2245,8 +2417,36 @@ snapshots: ms@2.1.2: {} + nanoid@3.3.7: {} + natural-compare@1.4.0: {} + next@14.2.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.8): + dependencies: + '@next/env': 14.2.15 + '@swc/helpers': 0.5.5 + busboy: 1.6.0 + caniuse-lite: 1.0.30001668 + graceful-fs: 4.2.11 + postcss: 8.4.31 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + styled-jsx: 5.1.1(react@18.3.1) + 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 + sass: 1.77.8 + transitivePeerDependencies: + - '@babel/core' + - babel-plugin-macros + normalize-path@3.0.0: {} once@1.4.0: @@ -2300,8 +2500,16 @@ snapshots: path-type@4.0.0: {} + picocolors@1.1.0: {} + picomatch@2.3.1: {} + postcss@8.4.31: + dependencies: + nanoid: 3.3.7 + picocolors: 1.1.0 + source-map-js: 1.2.0 + prelude-ls@1.2.1: {} prettier-linter-helpers@1.0.0: @@ -2448,6 +2656,8 @@ snapshots: sprintf-js@1.0.3: {} + streamsearch@1.1.0: {} + string-width@4.2.3: dependencies: emoji-regex: 8.0.0 @@ -2485,6 +2695,11 @@ snapshots: dependencies: inline-style-parser: 0.2.3 + styled-jsx@5.1.1(react@18.3.1): + dependencies: + client-only: 0.0.1 + react: 18.3.1 + supports-color@7.2.0: dependencies: has-flag: 4.0.0 From 1b3539fc3db019513efa36551461f5e489ebb7a6 Mon Sep 17 00:00:00 2001 From: Vordgi Date: Tue, 15 Oct 2024 22:10:09 +0400 Subject: [PATCH 2/4] rd-314 use next out of the box --- packages/robindoc/rollup.config.js | 2 + .../components/blocks/breadcrumbs/index.tsx | 5 +-- .../blocks/nav-content-link/index.tsx | 4 +- .../src/components/blocks/nav-link/index.tsx | 7 ++-- .../components/blocks/pagination/index.tsx | 7 ++-- .../src/components/blocks/search/index.tsx | 4 +- .../blocks/search/search-modal/index.tsx | 5 +-- .../blocks/section-dropdown/index.tsx | 4 +- .../components/contexts/sidebar/context.ts | 3 -- .../components/contexts/sidebar/provider.tsx | 10 ----- .../contexts/sidebar/use-sidebar-store.ts | 26 ------------- .../components/elements/article/document.tsx | 5 +-- .../src/components/elements/article/index.tsx | 9 +---- .../src/components/elements/header/index.tsx | 20 ++-------- .../elements/robin-provider/index.tsx | 5 +-- .../src/components/elements/sidebar/index.tsx | 21 ++++------ .../elements/sidebar/sidebar-drop/index.tsx | 38 ++++++++----------- .../elements/sidebar/sidebar-link/index.tsx | 15 ++++---- .../src/components/elements/sidebar/tools.ts | 16 ++++---- .../src/components/ui/content-link/index.tsx | 14 +++---- .../src/core/utils/initialize-robindoc.tsx | 12 ++---- site/src/app/api/search/route.ts | 2 +- site/src/app/docs/[[...path]]/page.tsx | 5 +-- site/src/app/docs/layout.tsx | 3 ++ .../app/docs/{[[...path]] => }/robindoc.ts | 0 site/src/app/layout.tsx | 2 - site/src/app/sitemap.ts | 2 +- 27 files changed, 75 insertions(+), 171 deletions(-) delete mode 100644 packages/robindoc/src/components/contexts/sidebar/context.ts delete mode 100644 packages/robindoc/src/components/contexts/sidebar/provider.tsx delete mode 100644 packages/robindoc/src/components/contexts/sidebar/use-sidebar-store.ts rename site/src/app/docs/{[[...path]] => }/robindoc.ts (100%) diff --git a/packages/robindoc/rollup.config.js b/packages/robindoc/rollup.config.js index b67386e3..d1469a70 100644 --- a/packages/robindoc/rollup.config.js +++ b/packages/robindoc/rollup.config.js @@ -19,6 +19,8 @@ module.exports = { external: [ "react", "react-dom", + "next/link", + "next/navigation", "html-react-parser", "gray-matter", "marked", diff --git a/packages/robindoc/src/components/blocks/breadcrumbs/index.tsx b/packages/robindoc/src/components/blocks/breadcrumbs/index.tsx index 9eaa593b..ce7e9f15 100644 --- a/packages/robindoc/src/components/blocks/breadcrumbs/index.tsx +++ b/packages/robindoc/src/components/blocks/breadcrumbs/index.tsx @@ -8,15 +8,14 @@ import "./breadcrumbs.scss"; export type BreadcrumbsProps = { title: string; breadcrumbs: BreadcrumbsType; - link?: React.ElementType; }; -export const Breadcrumbs: React.FC = async ({ title, breadcrumbs, link }) => { +export const Breadcrumbs: React.FC = async ({ title, breadcrumbs }) => { return (