chore: update next

This commit is contained in:
DIYgod 2023-07-08 00:30:05 +01:00
parent dd1cc3e1f5
commit 0d90104d75
No known key found for this signature in database
14 changed files with 73 additions and 112 deletions

View File

@ -99,7 +99,7 @@
"medium-zoom": "1.0.8",
"mermaid": "10.2.4",
"nanoid": "4.0.2",
"next": "13.4.7",
"next": "13.4.9",
"node-id3": "0.2.6",
"pangu": "4.0.7",
"path-to-regexp": "6.2.1",
@ -188,7 +188,7 @@
"esbuild": "0.18.11",
"esbuild-register": "3.4.2",
"eslint": "8.44.0",
"eslint-config-next": "13.4.8",
"eslint-config-next": "13.4.9",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-unused-imports": "2.0.0",

View File

@ -213,8 +213,8 @@ dependencies:
specifier: 4.0.2
version: 4.0.2
next:
specifier: 13.4.7
version: 13.4.7(@babel/core@7.22.8)(react-dom@18.2.0)(react@18.2.0)
specifier: 13.4.9
version: 13.4.9(@babel/core@7.22.8)(react-dom@18.2.0)(react@18.2.0)
node-id3:
specifier: 0.2.6
version: 0.2.6
@ -387,7 +387,7 @@ dependencies:
devDependencies:
'@ducanh2912/next-pwa':
specifier: 9.1.4
version: 9.1.4(esbuild@0.18.11)(next@13.4.7)(webpack@5.88.1)
version: 9.1.4(esbuild@0.18.11)(next@13.4.9)(webpack@5.88.1)
'@iconify/tailwind':
specifier: 0.1.3
version: 0.1.3
@ -476,8 +476,8 @@ devDependencies:
specifier: 8.44.0
version: 8.44.0
eslint-config-next:
specifier: 13.4.8
version: 13.4.8(eslint@8.44.0)(typescript@5.1.6)
specifier: 13.4.9
version: 13.4.9(eslint@8.44.0)(typescript@5.1.6)
eslint-plugin-import:
specifier: 2.27.5
version: 2.27.5(@typescript-eslint/parser@5.61.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.44.0)
@ -2713,7 +2713,7 @@ packages:
resolution: {integrity: sha512-bhR5k5W+8GLzysjk8zTMVygQZsgvf7W1F0IlL4ZQ5ugjo5rCyiwGM5d8DYriXspytfu98tv59niang3/T+FoDw==}
dev: false
/@ducanh2912/next-pwa@9.1.4(esbuild@0.18.11)(next@13.4.7)(webpack@5.88.1):
/@ducanh2912/next-pwa@9.1.4(esbuild@0.18.11)(next@13.4.9)(webpack@5.88.1):
resolution: {integrity: sha512-SXrgLAhcHLmInuwv+xzBYo1KutlCws/8SDwNn2QsKwoLQAgvFIpeRNP/k86u7wLNZ2BJLUmG2uU5YvnWdWNnCA==}
peerDependencies:
next: '>=11.0.0'
@ -2721,7 +2721,7 @@ packages:
dependencies:
clean-webpack-plugin: 4.0.0(webpack@5.88.1)
fast-glob: 3.2.12
next: 13.4.7(@babel/core@7.22.8)(react-dom@18.2.0)(react@18.2.0)
next: 13.4.9(@babel/core@7.22.8)(react-dom@18.2.0)(react@18.2.0)
semver: 7.5.3
terser-webpack-plugin: 5.3.9(esbuild@0.18.11)(webpack@5.88.1)
webpack: 5.88.1(esbuild@0.18.11)
@ -3603,81 +3603,81 @@ packages:
- utf-8-validate
dev: true
/@next/env@13.4.7:
resolution: {integrity: sha512-ZlbiFulnwiFsW9UV1ku1OvX/oyIPLtMk9p/nnvDSwI0s7vSoZdRtxXNsaO+ZXrLv/pMbXVGq4lL8TbY9iuGmVw==}
/@next/env@13.4.9:
resolution: {integrity: sha512-vuDRK05BOKfmoBYLNi2cujG2jrYbEod/ubSSyqgmEx9n/W3eZaJQdRNhTfumO+qmq/QTzLurW487n/PM/fHOkw==}
/@next/eslint-plugin-next@13.4.8:
resolution: {integrity: sha512-cmfVHpxWjjcETFt2WHnoFU6EmY69QcPJRlRNAooQlNe53Ke90vg1Ci/dkPffryJZaxxiRziP9bQrV8lDVCn3Fw==}
/@next/eslint-plugin-next@13.4.9:
resolution: {integrity: sha512-nDtGpa992tNyAkT/KmSMy7QkHfNZmGCBYhHtafU97DubqxzNdvLsqRtliQ4FU04CysRCtvP2hg8rRC1sAKUTUA==}
dependencies:
glob: 7.1.7
dev: true
/@next/swc-darwin-arm64@13.4.7:
resolution: {integrity: sha512-VZTxPv1b59KGiv/pZHTO5Gbsdeoxcj2rU2cqJu03btMhHpn3vwzEK0gUSVC/XW96aeGO67X+cMahhwHzef24/w==}
/@next/swc-darwin-arm64@13.4.9:
resolution: {integrity: sha512-TVzGHpZoVBk3iDsTOQA/R6MGmFp0+17SWXMEWd6zG30AfuELmSSMe2SdPqxwXU0gbpWkJL1KgfLzy5ReN0crqQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
optional: true
/@next/swc-darwin-x64@13.4.7:
resolution: {integrity: sha512-gO2bw+2Ymmga+QYujjvDz9955xvYGrWofmxTq7m70b9pDPvl7aDFABJOZ2a8SRCuSNB5mXU8eTOmVVwyp/nAew==}
/@next/swc-darwin-x64@13.4.9:
resolution: {integrity: sha512-aSfF1fhv28N2e7vrDZ6zOQ+IIthocfaxuMWGReB5GDriF0caTqtHttAvzOMgJgXQtQx6XhyaJMozLTSEXeNN+A==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
requiresBuild: true
optional: true
/@next/swc-linux-arm64-gnu@13.4.7:
resolution: {integrity: sha512-6cqp3vf1eHxjIDhEOc7Mh/s8z1cwc/l5B6ZNkOofmZVyu1zsbEM5Hmx64s12Rd9AYgGoiCz4OJ4M/oRnkE16/Q==}
/@next/swc-linux-arm64-gnu@13.4.9:
resolution: {integrity: sha512-JhKoX5ECzYoTVyIy/7KykeO4Z2lVKq7HGQqvAH+Ip9UFn1MOJkOnkPRB7v4nmzqAoY+Je05Aj5wNABR1N18DMg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
requiresBuild: true
optional: true
/@next/swc-linux-arm64-musl@13.4.7:
resolution: {integrity: sha512-T1kD2FWOEy5WPidOn1si0rYmWORNch4a/NR52Ghyp4q7KyxOCuiOfZzyhVC5tsLIBDH3+cNdB5DkD9afpNDaOw==}
/@next/swc-linux-arm64-musl@13.4.9:
resolution: {integrity: sha512-OOn6zZBIVkm/4j5gkPdGn4yqQt+gmXaLaSjRSO434WplV8vo2YaBNbSHaTM9wJpZTHVDYyjzuIYVEzy9/5RVZw==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
requiresBuild: true
optional: true
/@next/swc-linux-x64-gnu@13.4.7:
resolution: {integrity: sha512-zaEC+iEiAHNdhl6fuwl0H0shnTzQoAoJiDYBUze8QTntE/GNPfTYpYboxF5LRYIjBwETUatvE0T64W6SKDipvg==}
/@next/swc-linux-x64-gnu@13.4.9:
resolution: {integrity: sha512-iA+fJXFPpW0SwGmx/pivVU+2t4zQHNOOAr5T378PfxPHY6JtjV6/0s1vlAJUdIHeVpX98CLp9k5VuKgxiRHUpg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
requiresBuild: true
optional: true
/@next/swc-linux-x64-musl@13.4.7:
resolution: {integrity: sha512-X6r12F8d8SKAtYJqLZBBMIwEqcTRvUdVm+xIq+l6pJqlgT2tNsLLf2i5Cl88xSsIytBICGsCNNHd+siD2fbWBA==}
/@next/swc-linux-x64-musl@13.4.9:
resolution: {integrity: sha512-rlNf2WUtMM+GAQrZ9gMNdSapkVi3koSW3a+dmBVp42lfugWVvnyzca/xJlN48/7AGx8qu62WyO0ya1ikgOxh6A==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
requiresBuild: true
optional: true
/@next/swc-win32-arm64-msvc@13.4.7:
resolution: {integrity: sha512-NPnmnV+vEIxnu6SUvjnuaWRglZzw4ox5n/MQTxeUhb5iwVWFedolPFebMNwgrWu4AELwvTdGtWjqof53AiWHcw==}
/@next/swc-win32-arm64-msvc@13.4.9:
resolution: {integrity: sha512-5T9ybSugXP77nw03vlgKZxD99AFTHaX8eT1ayKYYnGO9nmYhJjRPxcjU5FyYI+TdkQgEpIcH7p/guPLPR0EbKA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
requiresBuild: true
optional: true
/@next/swc-win32-ia32-msvc@13.4.7:
resolution: {integrity: sha512-6Hxijm6/a8XqLQpOOf/XuwWRhcuc/g4rBB2oxjgCMuV9Xlr2bLs5+lXyh8w9YbAUMYR3iC9mgOlXbHa79elmXw==}
/@next/swc-win32-ia32-msvc@13.4.9:
resolution: {integrity: sha512-ojZTCt1lP2ucgpoiFgrFj07uq4CZsq4crVXpLGgQfoFq00jPKRPgesuGPaz8lg1yLfvafkU3Jd1i8snKwYR3LA==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
requiresBuild: true
optional: true
/@next/swc-win32-x64-msvc@13.4.7:
resolution: {integrity: sha512-sW9Yt36Db1nXJL+mTr2Wo0y+VkPWeYhygvcHj1FF0srVtV+VoDjxleKtny21QHaG05zdeZnw2fCtf2+dEqgwqA==}
/@next/swc-win32-x64-msvc@13.4.9:
resolution: {integrity: sha512-QbT03FXRNdpuL+e9pLnu+XajZdm/TtIXVYY4lA9t+9l0fLZbHXDYEKitAqxrOj37o3Vx5ufxiRAniaIebYDCgw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
@ -7320,8 +7320,8 @@ packages:
engines: {node: '>=12'}
dev: false
/eslint-config-next@13.4.8(eslint@8.44.0)(typescript@5.1.6):
resolution: {integrity: sha512-2hE0b6lHuhtHBX8VgEXi8v4G8PVrPUBMOSLCTq8qtcQ2qQOX7+uBOLK2kU4FD2qDZzyXNlhmuH+WLT5ptY4XLA==}
/eslint-config-next@13.4.9(eslint@8.44.0)(typescript@5.1.6):
resolution: {integrity: sha512-0fLtKRR268NArpqeXXwnLgMXPvF64YESQvptVg+RMLCaijKm3FICN9Y7Jc1p2o+yrWwE4DufJXDM/Vo53D1L7g==}
peerDependencies:
eslint: ^7.23.0 || ^8.0.0
typescript: '>=3.3.1'
@ -7329,7 +7329,7 @@ packages:
typescript:
optional: true
dependencies:
'@next/eslint-plugin-next': 13.4.8
'@next/eslint-plugin-next': 13.4.9
'@rushstack/eslint-patch': 1.3.2
'@typescript-eslint/parser': 5.61.0(eslint@8.44.0)(typescript@5.1.6)
eslint: 8.44.0
@ -7338,7 +7338,7 @@ packages:
eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.61.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.44.0)
eslint-plugin-jsx-a11y: 6.7.1(eslint@8.44.0)
eslint-plugin-react: 7.32.2(eslint@8.44.0)
eslint-plugin-react-hooks: 4.6.0(eslint@8.44.0)
eslint-plugin-react-hooks: 5.0.0-canary-7118f5dd7-20230705(eslint@8.44.0)
typescript: 5.1.6
transitivePeerDependencies:
- eslint-import-resolver-webpack
@ -7467,8 +7467,8 @@ packages:
semver: 6.3.0
dev: true
/eslint-plugin-react-hooks@4.6.0(eslint@8.44.0):
resolution: {integrity: sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==}
/eslint-plugin-react-hooks@5.0.0-canary-7118f5dd7-20230705(eslint@8.44.0):
resolution: {integrity: sha512-AZYbMo/NW9chdL7vk6HQzQhT+PvTAEVqWk9ziruUoW2kAOcN5qNyelv70e0F1VNQAbvutOC9oc+xfWycI9FxDw==}
engines: {node: '>=10'}
peerDependencies:
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0
@ -10324,8 +10324,8 @@ packages:
resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==}
dev: true
/next@13.4.7(@babel/core@7.22.8)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-M8z3k9VmG51SRT6v5uDKdJXcAqLzP3C+vaKfLIAM0Mhx1um1G7MDnO63+m52qPdZfrTFzMZNzfsgvm3ghuVHIQ==}
/next@13.4.9(@babel/core@7.22.8)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-vtefFm/BWIi/eWOqf1GsmKG3cjKw1k3LjuefKRcL3iiLl3zWzFdPG3as6xtxrGO6gwTzzaO1ktL4oiHt/uvTjA==}
engines: {node: '>=16.8.0'}
hasBin: true
peerDependencies:
@ -10342,7 +10342,7 @@ packages:
sass:
optional: true
dependencies:
'@next/env': 13.4.7
'@next/env': 13.4.9
'@swc/helpers': 0.5.1
busboy: 1.6.0
caniuse-lite: 1.0.30001513
@ -10353,15 +10353,15 @@ packages:
watchpack: 2.4.0
zod: 3.21.4
optionalDependencies:
'@next/swc-darwin-arm64': 13.4.7
'@next/swc-darwin-x64': 13.4.7
'@next/swc-linux-arm64-gnu': 13.4.7
'@next/swc-linux-arm64-musl': 13.4.7
'@next/swc-linux-x64-gnu': 13.4.7
'@next/swc-linux-x64-musl': 13.4.7
'@next/swc-win32-arm64-msvc': 13.4.7
'@next/swc-win32-ia32-msvc': 13.4.7
'@next/swc-win32-x64-msvc': 13.4.7
'@next/swc-darwin-arm64': 13.4.9
'@next/swc-darwin-x64': 13.4.9
'@next/swc-linux-arm64-gnu': 13.4.9
'@next/swc-linux-arm64-musl': 13.4.9
'@next/swc-linux-x64-gnu': 13.4.9
'@next/swc-linux-x64-musl': 13.4.9
'@next/swc-win32-arm64-msvc': 13.4.9
'@next/swc-win32-ia32-msvc': 13.4.9
'@next/swc-win32-x64-msvc': 13.4.9
transitivePeerDependencies:
- '@babel/core'
- babel-plugin-macros

View File

@ -2,7 +2,7 @@ import { Metadata } from "next"
import { HomeFeed } from "~/components/home/HomeFeed"
import { APP_NAME } from "~/lib/env"
import { useTranslation } from "~/lib/i18n"
import { getTranslation } from "~/lib/i18n"
import topics from "../../../../../../data/topics.json"
@ -26,7 +26,7 @@ export default async function Topic({
topic: string
}
}) {
const { t } = await useTranslation("index")
const { t } = await getTranslation("index")
params.topic = decodeURIComponent(params.topic)
const info = topics.find((t) => t.name === params.topic)

View File

@ -9,10 +9,10 @@ import { Button } from "~/components/ui/Button"
import { Image } from "~/components/ui/Image"
import { CSB_SCAN, GITHUB_LINK } from "~/lib/env"
import { getSiteLink } from "~/lib/helpers"
import { Trans, useTranslation } from "~/lib/i18n"
import { Trans, getTranslation } from "~/lib/i18n"
async function Home() {
const { t, i18n } = await useTranslation("index")
const { t, i18n } = await getTranslation("index")
const EntranceButton = memo(function Button() {
return (

View File

@ -7,7 +7,7 @@ import PostModal from "~/components/home/PostModal"
import { PostFooter } from "~/components/site/PostFooter"
import PostMeta from "~/components/site/PostMeta"
import { SiteHeader } from "~/components/site/SiteHeader"
import { useTranslation } from "~/lib/i18n"
import { getTranslation } from "~/lib/i18n"
import { toCid } from "~/lib/ipfs-parser"
import getQueryClient from "~/lib/query-client"
import { cn } from "~/lib/utils"
@ -44,8 +44,8 @@ export default async function SiteModal({
const dehydratedState = dehydrate(queryClient)
const { i18n } = await useTranslation()
const { t } = await useTranslation("common")
const { i18n } = await getTranslation()
const { t } = await getTranslation("common")
let summary: string | undefined
if (!page.metadata.content.disableAISummary) {
summary = await getSummary({

View File

@ -7,7 +7,7 @@ import "@crossbell/connect-kit/colors.css"
import { updateIndexerFetchOptions } from "@crossbell/indexer"
import "~/css/main.css"
import { useAcceptLang } from "~/hooks/useAcceptLang"
import { getAcceptLang } from "~/lib/accept-lang"
import { APP_DESCRIPTION, APP_NAME, APP_SLOGAN, SITE_URL } from "~/lib/env"
import { getColorScheme } from "~/lib/get-color-scheme"
@ -81,7 +81,7 @@ export default function RootLayout({
children: React.ReactNode
modal: React.ReactNode
}) {
const lang = useAcceptLang()
const lang = getAcceptLang()
const colorScheme = getColorScheme()
// For viewing statistics

View File

@ -10,7 +10,7 @@ import { PostFooter } from "~/components/site/PostFooter"
import PostMeta from "~/components/site/PostMeta"
import { SITE_URL } from "~/lib/env"
import { getSiteLink } from "~/lib/helpers"
import { useTranslation } from "~/lib/i18n"
import { getTranslation } from "~/lib/i18n"
import { toCid } from "~/lib/ipfs-parser"
import { isInRN } from "~/lib/is-in-rn"
import getQueryClient from "~/lib/query-client"
@ -129,8 +129,8 @@ export default async function SitePagePage({
}
}
const { i18n } = await useTranslation()
const { t } = await useTranslation("common")
const { i18n } = await getTranslation()
const { t } = await getTranslation("common")
let summary: string | undefined
if (!page.metadata.content.disableAISummary) {
summary = await getSummary({

View File

@ -3,7 +3,7 @@ import Script from "next/script"
import { UniLink } from "~/components/ui/UniLink"
import { UniMedia } from "~/components/ui/UniMedia"
import { useTranslation } from "~/lib/i18n"
import { getTranslation } from "~/lib/i18n"
import { toGateway } from "~/lib/ipfs-parser"
import getQueryClient from "~/lib/query-client"
import { fetchGetSite, getNFTs } from "~/queries/site.server"
@ -36,7 +36,7 @@ export default async function SiteNFTPage({
const queryClient = getQueryClient()
const site = await fetchGetSite(params.site, queryClient)
const { t } = await useTranslation("common")
const { t } = await getTranslation("common")
let nfts = (await getNFTs(site?.owner)) ?? []

View File

@ -1,9 +1,9 @@
import { Image } from "~/components/ui/Image"
import { SITE_URL } from "~/lib/env"
import { useTranslation } from "~/lib/i18n"
import { getTranslation } from "~/lib/i18n"
export default async function NotFound() {
const { t } = await useTranslation("site")
const { t } = await getTranslation("site")
return (
<>

View File

@ -3,7 +3,7 @@ import Script from "next/script"
import { Logo } from "~/components/common/Logo"
import { Platform } from "~/components/site/Platform"
import { SITE_URL } from "~/lib/env"
import { Trans, useTranslation } from "~/lib/i18n"
import { Trans, getTranslation } from "~/lib/i18n"
import { ExpandedCharacter } from "~/lib/types"
import { DarkModeSwitch } from "../common/DarkModeSwitch"
@ -26,7 +26,7 @@ export default async function SiteFooter({
)
}
const { i18n } = await useTranslation("site")
const { i18n } = await getTranslation("site")
return (
<>

View File

@ -1,39 +0,0 @@
import dayjs from "dayjs"
import "dayjs/locale/en"
import "dayjs/locale/ja"
import "dayjs/locale/zh"
import "dayjs/locale/zh-tw"
import duration from "dayjs/plugin/duration"
import localizedFormat from "dayjs/plugin/localizedFormat"
import relativeTime from "dayjs/plugin/relativeTime"
import tz from "dayjs/plugin/timezone"
import utc from "dayjs/plugin/utc"
import { useMemo } from "react"
import { useTranslation } from "~/lib/i18n"
dayjs.extend(localizedFormat)
dayjs.extend(utc)
dayjs.extend(tz)
dayjs.extend(duration)
dayjs.extend(relativeTime)
export async function useDate() {
const { i18n } = await useTranslation()
const memoizedDateUtils = useMemo(() => {
dayjs.locale(i18n.resolvedLanguage)
return {
dayjs,
formatDate: (date: string | Date, format = "ll", timezone?: string) => {
return dayjs(date).tz(timezone).format(format)
},
formatToISO: (date: string | Date) => {
return dayjs(date || undefined).toISOString()
},
}
}, [i18n.resolvedLanguage])
return memoizedDateUtils
}

View File

@ -2,7 +2,7 @@ import { headers } from "next/headers"
import { fallbackLng } from "~/lib/i18n/settings"
export function useAcceptLang() {
export function getAcceptLang() {
let lng = fallbackLng
let acceptLang = headers().get("accept-language")?.split(",")[0]

View File

@ -3,7 +3,7 @@ import resourcesToBackend from "i18next-resources-to-backend"
import { Trans as TransW } from "react-i18next/TransWithoutContext"
import { initReactI18next } from "react-i18next/initReactI18next"
import { useAcceptLang } from "~/hooks/useAcceptLang"
import { getAcceptLang } from "~/lib/accept-lang"
import { defaultNS, getOptions } from "./settings"
@ -21,8 +21,8 @@ const initI18next = async (lng: string, ns: string) => {
return i18nInstance
}
export async function useTranslation(ns: string = defaultNS) {
const lang = useAcceptLang()
export async function getTranslation(ns: string = defaultNS) {
const lang = getAcceptLang()
const i18nextInstance = await initI18next(lang, ns)
return {
t: i18nextInstance.getFixedT(lang, ns),

View File

@ -109,7 +109,7 @@ export const renderPageContent = (
.use(remarkParse)
.use(remarkBreaks)
.use(remarkFrontmatter, ["yaml"])
.use(() => (tree) => {
.use(() => (tree: Root) => {
const yaml = tree.children.find((node) => node.type === "yaml")
if ((yaml as any)?.value) {
try {
@ -135,7 +135,7 @@ export const renderPageContent = (
})
.use(remarkPangu)
.use(() => (tree) => {
env.toc = toc(tree, { tight: true, ordered: true })
env.toc = toc(tree as any, { tight: true, ordered: true })
})
.use(remarkRehype, { allowDangerousHtml: true })
.use(emoji)