mirror of https://github.com/langgenius/dify.git
refactor: route low-cost next modules through compat re-exports (#33622)
This commit is contained in:
parent
bbe975c6bc
commit
d7f70f3c0f
|
|
@ -13,7 +13,6 @@ import {
|
||||||
RiTerminalWindowLine,
|
RiTerminalWindowLine,
|
||||||
} from '@remixicon/react'
|
} from '@remixicon/react'
|
||||||
import { useUnmount } from 'ahooks'
|
import { useUnmount } from 'ahooks'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import { usePathname, useRouter } from 'next/navigation'
|
import { usePathname, useRouter } from 'next/navigation'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect, useState } from 'react'
|
||||||
|
|
@ -26,6 +25,7 @@ import { useStore as useTagStore } from '@/app/components/base/tag-management/st
|
||||||
import { useAppContext } from '@/context/app-context'
|
import { useAppContext } from '@/context/app-context'
|
||||||
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
|
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
|
||||||
import useDocumentTitle from '@/hooks/use-document-title'
|
import useDocumentTitle from '@/hooks/use-document-title'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import { fetchAppDetailDirect } from '@/service/apps'
|
import { fetchAppDetailDirect } from '@/service/apps'
|
||||||
import { AppModeEnum } from '@/types/app'
|
import { AppModeEnum } from '@/types/app'
|
||||||
import { cn } from '@/utils/classnames'
|
import { cn } from '@/utils/classnames'
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ import type { DuplicateAppModalProps } from '@/app/components/app/duplicate-moda
|
||||||
import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal'
|
import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal'
|
||||||
import type { EnvironmentVariable } from '@/app/components/workflow/types'
|
import type { EnvironmentVariable } from '@/app/components/workflow/types'
|
||||||
import type { App, AppSSO } from '@/types/app'
|
import type { App, AppSSO } from '@/types/app'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
|
|
||||||
const SwitchAppModal = dynamic(() => import('@/app/components/app/switch-app-modal'), { ssr: false })
|
const SwitchAppModal = dynamic(() => import('@/app/components/app/switch-app-modal'), { ssr: false })
|
||||||
const CreateAppModal = dynamic(() => import('@/app/components/explore/create-app-modal'), { ssr: false })
|
const CreateAppModal = dynamic(() => import('@/app/components/explore/create-app-modal'), { ssr: false })
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import type { CreateAppModalProps } from '@/app/components/explore/create-app-mo
|
||||||
import type { EnvironmentVariable } from '@/app/components/workflow/types'
|
import type { EnvironmentVariable } from '@/app/components/workflow/types'
|
||||||
import type { App } from '@/types/app'
|
import type { App } from '@/types/app'
|
||||||
import { RiBuildingLine, RiGlobalLine, RiLockLine, RiMoreFill, RiVerifiedBadgeLine } from '@remixicon/react'
|
import { RiBuildingLine, RiGlobalLine, RiLockLine, RiMoreFill, RiVerifiedBadgeLine } from '@remixicon/react'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react'
|
import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||||
|
|
@ -36,6 +35,7 @@ import { useGlobalPublicStore } from '@/context/global-public-context'
|
||||||
import { useProviderContext } from '@/context/provider-context'
|
import { useProviderContext } from '@/context/provider-context'
|
||||||
import { useAsyncWindowOpen } from '@/hooks/use-async-window-open'
|
import { useAsyncWindowOpen } from '@/hooks/use-async-window-open'
|
||||||
import { AccessMode } from '@/models/access-control'
|
import { AccessMode } from '@/models/access-control'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import { useGetUserCanAccessApp } from '@/service/access-control'
|
import { useGetUserCanAccessApp } from '@/service/access-control'
|
||||||
import { copyApp, exportAppConfig, updateAppInfo } from '@/service/apps'
|
import { copyApp, exportAppConfig, updateAppInfo } from '@/service/apps'
|
||||||
import { fetchInstalledAppList } from '@/service/explore'
|
import { fetchInstalledAppList } from '@/service/explore'
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import { useDebounceFn } from 'ahooks'
|
import { useDebounceFn } from 'ahooks'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import { parseAsStringLiteral, useQueryState } from 'nuqs'
|
import { parseAsStringLiteral, useQueryState } from 'nuqs'
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
@ -15,6 +14,7 @@ import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
|
||||||
import { useAppContext } from '@/context/app-context'
|
import { useAppContext } from '@/context/app-context'
|
||||||
import { useGlobalPublicStore } from '@/context/global-public-context'
|
import { useGlobalPublicStore } from '@/context/global-public-context'
|
||||||
import { CheckModal } from '@/hooks/use-pay'
|
import { CheckModal } from '@/hooks/use-pay'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import { useInfiniteAppList } from '@/service/use-apps'
|
import { useInfiniteAppList } from '@/service/use-apps'
|
||||||
import { AppModeEnum, AppModes } from '@/types/app'
|
import { AppModeEnum, AppModes } from '@/types/app'
|
||||||
import { cn } from '@/utils/classnames'
|
import { cn } from '@/utils/classnames'
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import {
|
import {
|
||||||
useRouter,
|
useRouter,
|
||||||
useSearchParams,
|
useSearchParams,
|
||||||
|
|
@ -13,6 +12,7 @@ import { CreateFromDSLModalTab } from '@/app/components/app/create-from-dsl-moda
|
||||||
import { FileArrow01, FilePlus01, FilePlus02 } from '@/app/components/base/icons/src/vender/line/files'
|
import { FileArrow01, FilePlus01, FilePlus02 } from '@/app/components/base/icons/src/vender/line/files'
|
||||||
import AppListContext from '@/context/app-list-context'
|
import AppListContext from '@/context/app-list-context'
|
||||||
import { useProviderContext } from '@/context/provider-context'
|
import { useProviderContext } from '@/context/provider-context'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import { cn } from '@/utils/classnames'
|
import { cn } from '@/utils/classnames'
|
||||||
|
|
||||||
const CreateAppModal = dynamic(() => import('@/app/components/app/create-app-modal'), {
|
const CreateAppModal = dynamic(() => import('@/app/components/app/create-app-modal'), {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from '@/next/dynamic'
|
||||||
|
|
||||||
type DynamicPdfPreviewProps = {
|
type DynamicPdfPreviewProps = {
|
||||||
url: string
|
url: string
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import { headers } from 'next/headers'
|
|
||||||
import Script from 'next/script'
|
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { IS_CE_EDITION, IS_PROD } from '@/config'
|
import { IS_CE_EDITION, IS_PROD } from '@/config'
|
||||||
|
import { headers } from '@/next/headers'
|
||||||
|
import Script from '@/next/script'
|
||||||
|
|
||||||
export enum GaType {
|
export enum GaType {
|
||||||
admin = 'admin',
|
admin = 'admin',
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import ReactEcharts from 'echarts-for-react'
|
import ReactEcharts from 'echarts-for-react'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import SyntaxHighlighter from 'react-syntax-highlighter'
|
import SyntaxHighlighter from 'react-syntax-highlighter'
|
||||||
import {
|
import {
|
||||||
|
|
@ -12,6 +11,7 @@ import MarkdownMusic from '@/app/components/base/markdown-blocks/music'
|
||||||
import ErrorBoundary from '@/app/components/base/markdown/error-boundary'
|
import ErrorBoundary from '@/app/components/base/markdown/error-boundary'
|
||||||
import SVGBtn from '@/app/components/base/svg'
|
import SVGBtn from '@/app/components/base/svg'
|
||||||
import useTheme from '@/hooks/use-theme'
|
import useTheme from '@/hooks/use-theme'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import { Theme } from '@/types/app'
|
import { Theme } from '@/types/app'
|
||||||
import SVGRenderer from '../svg-gallery' // Assumes svg-gallery.tsx is in /base directory
|
import SVGRenderer from '../svg-gallery' // Assumes svg-gallery.tsx is in /base directory
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import type { SimplePluginInfo, StreamdownWrapperProps } from './streamdown-wrapper'
|
import type { SimplePluginInfo, StreamdownWrapperProps } from './streamdown-wrapper'
|
||||||
import { flow } from 'es-toolkit/compat'
|
import { flow } from 'es-toolkit/compat'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import { memo, useMemo } from 'react'
|
import { memo, useMemo } from 'react'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import { cn } from '@/utils/classnames'
|
import { cn } from '@/utils/classnames'
|
||||||
import { preprocessLaTeX, preprocessThinkTag } from './markdown-utils'
|
import { preprocessLaTeX, preprocessThinkTag } from './markdown-utils'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import type { ComponentType } from 'react'
|
import type { ComponentType } from 'react'
|
||||||
import type { Components, StreamdownProps } from 'streamdown'
|
import type { Components, StreamdownProps } from 'streamdown'
|
||||||
import { createMathPlugin } from '@streamdown/math'
|
import { createMathPlugin } from '@streamdown/math'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import { memo, useMemo } from 'react'
|
import { memo, useMemo } from 'react'
|
||||||
import RemarkBreaks from 'remark-breaks'
|
import RemarkBreaks from 'remark-breaks'
|
||||||
import { defaultRehypePlugins, defaultRemarkPlugins, Streamdown } from 'streamdown'
|
import { defaultRehypePlugins, defaultRemarkPlugins, Streamdown } from 'streamdown'
|
||||||
|
|
@ -18,6 +17,7 @@ import {
|
||||||
VideoBlock,
|
VideoBlock,
|
||||||
} from '@/app/components/base/markdown-blocks'
|
} from '@/app/components/base/markdown-blocks'
|
||||||
import { ENABLE_SINGLE_DOLLAR_LATEX } from '@/config'
|
import { ENABLE_SINGLE_DOLLAR_LATEX } from '@/config'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import { customUrlTransform } from './markdown-utils'
|
import { customUrlTransform } from './markdown-utils'
|
||||||
import 'katex/dist/katex.min.css'
|
import 'katex/dist/katex.min.css'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { headers } from 'next/headers'
|
|
||||||
import Script from 'next/script'
|
|
||||||
import { memo } from 'react'
|
import { memo } from 'react'
|
||||||
import { IS_CE_EDITION, IS_PROD, ZENDESK_WIDGET_KEY } from '@/config'
|
import { IS_CE_EDITION, IS_PROD, ZENDESK_WIDGET_KEY } from '@/config'
|
||||||
|
import { headers } from '@/next/headers'
|
||||||
|
import Script from '@/next/script'
|
||||||
|
|
||||||
const Zendesk = async () => {
|
const Zendesk = async () => {
|
||||||
if (IS_CE_EDITION || !ZENDESK_WIDGET_KEY)
|
if (IS_CE_EDITION || !ZENDESK_WIDGET_KEY)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
'use client'
|
'use client'
|
||||||
import type { CustomFile as File, FileItem } from '@/models/datasets'
|
import type { CustomFile as File, FileItem } from '@/models/datasets'
|
||||||
import { RiDeleteBinLine, RiErrorWarningFill } from '@remixicon/react'
|
import { RiDeleteBinLine, RiErrorWarningFill } from '@remixicon/react'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
import DocumentFileIcon from '@/app/components/datasets/common/document-file-icon'
|
import DocumentFileIcon from '@/app/components/datasets/common/document-file-icon'
|
||||||
import useTheme from '@/hooks/use-theme'
|
import useTheme from '@/hooks/use-theme'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import { Theme } from '@/types/app'
|
import { Theme } from '@/types/app'
|
||||||
import { formatFileSize, getFileExtension } from '@/utils/format'
|
import { formatFileSize, getFileExtension } from '@/utils/format'
|
||||||
import { PROGRESS_COMPLETE, PROGRESS_ERROR } from '../constants'
|
import { PROGRESS_COMPLETE, PROGRESS_ERROR } from '../constants'
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import type { CustomFile as File, FileItem } from '@/models/datasets'
|
import type { CustomFile as File, FileItem } from '@/models/datasets'
|
||||||
import { RiDeleteBinLine, RiErrorWarningFill } from '@remixicon/react'
|
import { RiDeleteBinLine, RiErrorWarningFill } from '@remixicon/react'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
import DocumentFileIcon from '@/app/components/datasets/common/document-file-icon'
|
import DocumentFileIcon from '@/app/components/datasets/common/document-file-icon'
|
||||||
import { getFileType } from '@/app/components/datasets/common/image-uploader/utils'
|
import { getFileType } from '@/app/components/datasets/common/image-uploader/utils'
|
||||||
import useTheme from '@/hooks/use-theme'
|
import useTheme from '@/hooks/use-theme'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import { Theme } from '@/types/app'
|
import { Theme } from '@/types/app'
|
||||||
import { cn } from '@/utils/classnames'
|
import { cn } from '@/utils/classnames'
|
||||||
import { formatFileSize } from '@/utils/format'
|
import { formatFileSize } from '@/utils/format'
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import Script from 'next/script'
|
|
||||||
import { IS_DEV } from '@/config'
|
import { IS_DEV } from '@/config'
|
||||||
|
import Script from '@/next/script'
|
||||||
|
|
||||||
export function ReactGrabLoader() {
|
export function ReactGrabLoader() {
|
||||||
if (!IS_DEV)
|
if (!IS_DEV)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import Script from 'next/script'
|
|
||||||
import { IS_DEV } from '@/config'
|
import { IS_DEV } from '@/config'
|
||||||
|
import Script from '@/next/script'
|
||||||
|
|
||||||
export function ReactScanLoader() {
|
export function ReactScanLoader() {
|
||||||
if (!IS_DEV)
|
if (!IS_DEV)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import type { PanelProps } from '@/app/components/workflow/panel'
|
import type { PanelProps } from '@/app/components/workflow/panel'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import {
|
import {
|
||||||
memo,
|
memo,
|
||||||
useMemo,
|
useMemo,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import Panel from '@/app/components/workflow/panel'
|
import Panel from '@/app/components/workflow/panel'
|
||||||
import { useStore } from '@/app/components/workflow/store'
|
import { useStore } from '@/app/components/workflow/store'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
|
|
||||||
const Record = dynamic(() => import('@/app/components/workflow/panel/record'), {
|
const Record = dynamic(() => import('@/app/components/workflow/panel/record'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import type {
|
||||||
TriggerDefaultValue,
|
TriggerDefaultValue,
|
||||||
} from '@/app/components/workflow/block-selector/types'
|
} from '@/app/components/workflow/block-selector/types'
|
||||||
import type { EnvironmentVariable } from '@/app/components/workflow/types'
|
import type { EnvironmentVariable } from '@/app/components/workflow/types'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import {
|
import {
|
||||||
memo,
|
memo,
|
||||||
useCallback,
|
useCallback,
|
||||||
|
|
@ -21,6 +20,7 @@ import { useStore } from '@/app/components/workflow/store'
|
||||||
import { BlockEnum } from '@/app/components/workflow/types'
|
import { BlockEnum } from '@/app/components/workflow/types'
|
||||||
import { generateNewNode } from '@/app/components/workflow/utils'
|
import { generateNewNode } from '@/app/components/workflow/utils'
|
||||||
import { useEventEmitterContextContext } from '@/context/event-emitter'
|
import { useEventEmitterContextContext } from '@/context/event-emitter'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import PluginDependency from '../../workflow/plugin-dependency'
|
import PluginDependency from '../../workflow/plugin-dependency'
|
||||||
import { useAvailableNodesMetaData } from '../hooks'
|
import { useAvailableNodesMetaData } from '../hooks'
|
||||||
import { useAutoOnboarding } from '../hooks/use-auto-onboarding'
|
import { useAutoOnboarding } from '../hooks/use-auto-onboarding'
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import type { PanelProps } from '@/app/components/workflow/panel'
|
import type { PanelProps } from '@/app/components/workflow/panel'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import {
|
import {
|
||||||
memo,
|
memo,
|
||||||
useMemo,
|
useMemo,
|
||||||
|
|
@ -8,6 +7,7 @@ import { useShallow } from 'zustand/react/shallow'
|
||||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||||
import Panel from '@/app/components/workflow/panel'
|
import Panel from '@/app/components/workflow/panel'
|
||||||
import { useStore } from '@/app/components/workflow/store'
|
import { useStore } from '@/app/components/workflow/store'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import {
|
import {
|
||||||
useIsChatMode,
|
useIsChatMode,
|
||||||
} from '../hooks'
|
} from '../hooks'
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import type { HeaderInNormalProps } from './header-in-normal'
|
import type { HeaderInNormalProps } from './header-in-normal'
|
||||||
import type { HeaderInRestoringProps } from './header-in-restoring'
|
import type { HeaderInRestoringProps } from './header-in-restoring'
|
||||||
import type { HeaderInHistoryProps } from './header-in-view-history'
|
import type { HeaderInHistoryProps } from './header-in-view-history'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import { usePathname } from 'next/navigation'
|
import { usePathname } from 'next/navigation'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import {
|
import {
|
||||||
useWorkflowMode,
|
useWorkflowMode,
|
||||||
} from '../hooks'
|
} from '../hooks'
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import {
|
||||||
} from 'ahooks'
|
} from 'ahooks'
|
||||||
import { isEqual } from 'es-toolkit/predicate'
|
import { isEqual } from 'es-toolkit/predicate'
|
||||||
import { setAutoFreeze } from 'immer'
|
import { setAutoFreeze } from 'immer'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import {
|
import {
|
||||||
memo,
|
memo,
|
||||||
useCallback,
|
useCallback,
|
||||||
|
|
@ -37,6 +36,7 @@ import ReactFlow, {
|
||||||
} from 'reactflow'
|
} from 'reactflow'
|
||||||
import { IS_DEV } from '@/config'
|
import { IS_DEV } from '@/config'
|
||||||
import { useEventEmitterContextContext } from '@/context/event-emitter'
|
import { useEventEmitterContextContext } from '@/context/event-emitter'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import {
|
import {
|
||||||
useAllBuiltInTools,
|
useAllBuiltInTools,
|
||||||
useAllCustomTools,
|
useAllCustomTools,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import type { FC } from 'react'
|
import type { FC } from 'react'
|
||||||
import type { VersionHistoryPanelProps } from '@/app/components/workflow/panel/version-history-panel'
|
import type { VersionHistoryPanelProps } from '@/app/components/workflow/panel/version-history-panel'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import { memo, useCallback, useEffect, useRef } from 'react'
|
import { memo, useCallback, useEffect, useRef } from 'react'
|
||||||
import { useStore as useReactflow } from 'reactflow'
|
import { useStore as useReactflow } from 'reactflow'
|
||||||
import { useShallow } from 'zustand/react/shallow'
|
import { useShallow } from 'zustand/react/shallow'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import { cn } from '@/utils/classnames'
|
import { cn } from '@/utils/classnames'
|
||||||
import { Panel as NodePanel } from '../nodes'
|
import { Panel as NodePanel } from '../nodes'
|
||||||
import { useStore } from '../store'
|
import { useStore } from '../store'
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { Viewport } from 'next'
|
import type { Viewport } from '@/next'
|
||||||
import { Agentation } from 'agentation'
|
import { Agentation } from 'agentation'
|
||||||
import { Provider as JotaiProvider } from 'jotai/react'
|
import { Provider as JotaiProvider } from 'jotai/react'
|
||||||
import { ThemeProvider } from 'next-themes'
|
import { ThemeProvider } from 'next-themes'
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import type { NextRequest } from 'next/server'
|
import type { NextRequest } from '@/next/server'
|
||||||
import { Octokit } from '@octokit/core'
|
import { Octokit } from '@octokit/core'
|
||||||
import { RequestError } from '@octokit/request-error'
|
import { RequestError } from '@octokit/request-error'
|
||||||
import { NextResponse } from 'next/server'
|
|
||||||
import { GITHUB_ACCESS_TOKEN } from '@/config'
|
import { GITHUB_ACCESS_TOKEN } from '@/config'
|
||||||
|
import { NextResponse } from '@/next/server'
|
||||||
|
|
||||||
type Params = {
|
type Params = {
|
||||||
owner: string
|
owner: string
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
'use client'
|
'use client'
|
||||||
import type { Locale } from '@/i18n-config'
|
import type { Locale } from '@/i18n-config'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import Divider from '@/app/components/base/divider'
|
import Divider from '@/app/components/base/divider'
|
||||||
import LocaleSigninSelect from '@/app/components/base/select/locale-signin'
|
import LocaleSigninSelect from '@/app/components/base/select/locale-signin'
|
||||||
import { useGlobalPublicStore } from '@/context/global-public-context'
|
import { useGlobalPublicStore } from '@/context/global-public-context'
|
||||||
import { useLocale } from '@/context/i18n'
|
import { useLocale } from '@/context/i18n'
|
||||||
import { setLocaleOnClient } from '@/i18n-config'
|
import { setLocaleOnClient } from '@/i18n-config'
|
||||||
import { languages } from '@/i18n-config/language'
|
import { languages } from '@/i18n-config/language'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
|
|
||||||
// Avoid rendering the logo and theme selector on the server
|
// Avoid rendering the logo and theme selector on the server
|
||||||
const DifyLogo = dynamic(() => import('@/app/components/base/logo/dify-logo'), {
|
const DifyLogo = dynamic(() => import('@/app/components/base/logo/dify-logo'), {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import type { InputVar } from '@/app/components/workflow/types'
|
||||||
import type { ExpireNoticeModalPayloadProps } from '@/app/education-apply/expire-notice-modal'
|
import type { ExpireNoticeModalPayloadProps } from '@/app/education-apply/expire-notice-modal'
|
||||||
import type { ApiBasedExtension, ExternalDataTool } from '@/models/common'
|
import type { ApiBasedExtension, ExternalDataTool } from '@/models/common'
|
||||||
import type { ModerationConfig, PromptVariable } from '@/models/debug'
|
import type { ModerationConfig, PromptVariable } from '@/models/debug'
|
||||||
import dynamic from 'next/dynamic'
|
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import {
|
import {
|
||||||
|
|
||||||
|
|
@ -27,6 +26,7 @@ import {
|
||||||
useAccountSettingModal,
|
useAccountSettingModal,
|
||||||
usePricingModal,
|
usePricingModal,
|
||||||
} from '@/hooks/use-query-params'
|
} from '@/hooks/use-query-params'
|
||||||
|
import dynamic from '@/next/dynamic'
|
||||||
import { useTriggerEventsLimitModal } from './hooks/use-trigger-events-limit-modal'
|
import { useTriggerEventsLimitModal } from './hooks/use-trigger-events-limit-modal'
|
||||||
import {
|
import {
|
||||||
ModalContext,
|
ModalContext,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,13 @@ process.env.TAILWIND_MODE ??= 'ESLINT'
|
||||||
|
|
||||||
const disableRuleAutoFix = !(isInEditorEnv() || isInGitHooksOrLintStaged())
|
const disableRuleAutoFix = !(isInEditorEnv() || isInGitHooksOrLintStaged())
|
||||||
|
|
||||||
|
const NEXT_PLATFORM_RESTRICTED_IMPORT_PATHS = [
|
||||||
|
{
|
||||||
|
name: 'next',
|
||||||
|
message: 'Import Next APIs from @/next instead of next.',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
const NEXT_PLATFORM_RESTRICTED_IMPORT_PATTERNS = [
|
const NEXT_PLATFORM_RESTRICTED_IMPORT_PATTERNS = [
|
||||||
{
|
{
|
||||||
group: ['next/image'],
|
group: ['next/image'],
|
||||||
|
|
@ -23,6 +30,22 @@ const NEXT_PLATFORM_RESTRICTED_IMPORT_PATTERNS = [
|
||||||
group: ['next/font', 'next/font/*'],
|
group: ['next/font', 'next/font/*'],
|
||||||
message: 'Do not import next/font. Use the project font styles instead.',
|
message: 'Do not import next/font. Use the project font styles instead.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
group: ['next/dynamic'],
|
||||||
|
message: 'Import Next APIs from @/next/dynamic instead of next/dynamic.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: ['next/headers'],
|
||||||
|
message: 'Import Next APIs from @/next/headers instead of next/headers.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: ['next/script'],
|
||||||
|
message: 'Import Next APIs from @/next/script instead of next/script.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: ['next/server'],
|
||||||
|
message: 'Import Next APIs from @/next/server instead of next/server.',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const OVERLAY_RESTRICTED_IMPORT_PATTERNS = [
|
const OVERLAY_RESTRICTED_IMPORT_PATTERNS = [
|
||||||
|
|
@ -240,10 +263,12 @@ export default antfu(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'dify/no-next-image-or-font',
|
name: 'dify/no-direct-next-imports',
|
||||||
files: [GLOB_TS, GLOB_TSX],
|
files: [GLOB_TS, GLOB_TSX],
|
||||||
|
ignores: ['next/**'],
|
||||||
rules: {
|
rules: {
|
||||||
'no-restricted-imports': ['error', {
|
'no-restricted-imports': ['error', {
|
||||||
|
paths: NEXT_PLATFORM_RESTRICTED_IMPORT_PATHS,
|
||||||
patterns: NEXT_PLATFORM_RESTRICTED_IMPORT_PATTERNS,
|
patterns: NEXT_PLATFORM_RESTRICTED_IMPORT_PATTERNS,
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
|
|
@ -252,11 +277,13 @@ export default antfu(
|
||||||
name: 'dify/overlay-migration',
|
name: 'dify/overlay-migration',
|
||||||
files: [GLOB_TS, GLOB_TSX],
|
files: [GLOB_TS, GLOB_TSX],
|
||||||
ignores: [
|
ignores: [
|
||||||
|
'next/**',
|
||||||
...GLOB_TESTS,
|
...GLOB_TESTS,
|
||||||
...OVERLAY_MIGRATION_LEGACY_BASE_FILES,
|
...OVERLAY_MIGRATION_LEGACY_BASE_FILES,
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
'no-restricted-imports': ['error', {
|
'no-restricted-imports': ['error', {
|
||||||
|
paths: NEXT_PLATFORM_RESTRICTED_IMPORT_PATHS,
|
||||||
patterns: [
|
patterns: [
|
||||||
...NEXT_PLATFORM_RESTRICTED_IMPORT_PATTERNS,
|
...NEXT_PLATFORM_RESTRICTED_IMPORT_PATTERNS,
|
||||||
...OVERLAY_RESTRICTED_IMPORT_PATTERNS,
|
...OVERLAY_RESTRICTED_IMPORT_PATTERNS,
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ import { camelCase } from 'es-toolkit/string'
|
||||||
import { createInstance } from 'i18next'
|
import { createInstance } from 'i18next'
|
||||||
import resourcesToBackend from 'i18next-resources-to-backend'
|
import resourcesToBackend from 'i18next-resources-to-backend'
|
||||||
import Negotiator from 'negotiator'
|
import Negotiator from 'negotiator'
|
||||||
import { cookies, headers } from 'next/headers'
|
|
||||||
import { cache } from 'react'
|
import { cache } from 'react'
|
||||||
import { initReactI18next } from 'react-i18next/initReactI18next'
|
import { initReactI18next } from 'react-i18next/initReactI18next'
|
||||||
|
import { cookies, headers } from '@/next/headers'
|
||||||
import { serverOnlyContext } from '@/utils/server-only-context'
|
import { serverOnlyContext } from '@/utils/server-only-context'
|
||||||
import { i18n } from '.'
|
import { i18n } from '.'
|
||||||
import { namespacesInFileName } from './resources'
|
import { namespacesInFileName } from './resources'
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { NextConfig } from 'next'
|
import type { NextConfig } from '@/next'
|
||||||
import createMDX from '@next/mdx'
|
import createMDX from '@next/mdx'
|
||||||
import { codeInspectorPlugin } from 'code-inspector-plugin'
|
import { codeInspectorPlugin } from 'code-inspector-plugin'
|
||||||
import { env } from './env'
|
import { env } from './env'
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
export { default } from 'next/dynamic'
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
export { cookies, headers } from 'next/headers'
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
export type { NextConfig, Viewport } from 'next'
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
export { default } from 'next/script'
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
export { NextResponse } from 'next/server'
|
||||||
|
export type { NextRequest } from 'next/server'
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import type { NextRequest } from 'next/server'
|
import type { NextRequest } from '@/next/server'
|
||||||
import { Buffer } from 'node:buffer'
|
import { Buffer } from 'node:buffer'
|
||||||
import { NextResponse } from 'next/server'
|
|
||||||
import { env } from '@/env'
|
import { env } from '@/env'
|
||||||
|
import { NextResponse } from '@/next/server'
|
||||||
|
|
||||||
const NECESSARY_DOMAIN = '*.sentry.io http://localhost:* http://127.0.0.1:* https://analytics.google.com googletagmanager.com *.googletagmanager.com https://www.google-analytics.com https://api.github.com https://api2.amplitude.com *.amplitude.com'
|
const NECESSARY_DOMAIN = '*.sentry.io http://localhost:* http://127.0.0.1:* https://analytics.google.com googletagmanager.com *.googletagmanager.com https://www.google-analytics.com https://api.github.com https://api2.amplitude.com *.amplitude.com'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue