There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
refactor: merge `plugin-infra` into `infra` (#3540)
Alex Yang0e3280324782
diff --git a/.commitlintrc.json b/.commitlintrc.jsonindex e08e9c6a5f..367a528c4c 100644--- a/.commitlintrc.json+++ b/.commitlintrc.json@@ -24,7 +24,6 @@"debug","storage","infra",- "plugin-infra","plugin-cli","sdk"]diff --git a/.eslintrc.js b/.eslintrc.jsindex 53da9ed66a..d3285c0b80 100644--- a/.eslintrc.js+++ b/.eslintrc.js@@ -43,7 +43,8 @@ const allPackages = ['packages/i18n','packages/jotai','packages/native',- 'packages/plugin-infra',+ 'packages/infra',+ 'packages/sdk','packages/templates','packages/theme','packages/workspace',diff --git a/.github/labeler.yml b/.github/labeler.ymlindex 8308388b27..87d0fa6dae 100644--- a/.github/labeler.yml+++ b/.github/labeler.yml@@ -23,7 +23,6 @@ plugin:copilot:- 'plugins/copilot/**/*'mod:infra:- - 'packages/plugin-infra/**/*'- 'packages/infra/**/*'mod:sdk:diff --git a/apps/core/src/_plugin/index.test.tsx b/apps/core/src/_plugin/index.test.tsxindex dd045064b5..be34a887d3 100644--- a/apps/core/src/_plugin/index.test.tsx+++ b/apps/core/src/_plugin/index.test.tsx@@ -1,8 +1,5 @@import { assertExists } from '@blocksuite/global/utils';-import {- registeredPluginAtom,- rootStore,-} from '@toeverything/plugin-infra/atom';+import { registeredPluginAtom, rootStore } from '@toeverything/infra/atom';import { use } from 'foxact/use';import { useAtomValue } from 'jotai';import { Provider } from 'jotai/react';diff --git a/apps/core/src/adapters/local/index.tsx b/apps/core/src/adapters/local/index.tsxindex 52377c3aac..fd844d6b7d 100644--- a/apps/core/src/adapters/local/index.tsx+++ b/apps/core/src/adapters/local/index.tsx@@ -19,7 +19,7 @@ import {import { getOrCreateWorkspace } from '@affine/workspace/manager';import { createIndexedDBDownloadProvider } from '@affine/workspace/providers';import { nanoid } from '@blocksuite/store';-import { useStaticBlockSuiteWorkspace } from '@toeverything/plugin-infra/__internal__/react';+import { useStaticBlockSuiteWorkspace } from '@toeverything/infra/__internal__/react';import {BlockSuitePageList,diff --git a/apps/core/src/atoms/mode.ts b/apps/core/src/atoms/mode.tsindex 9bb8fdb23c..641f6f8186 100644--- a/apps/core/src/atoms/mode.ts+++ b/apps/core/src/atoms/mode.ts@@ -1,4 +1,4 @@-import { currentPageIdAtom } from '@toeverything/plugin-infra/atom';+import { currentPageIdAtom } from '@toeverything/infra/atom';import { atom } from 'jotai/vanilla';import { pageSettingFamily } from './index';diff --git a/apps/core/src/bootstrap/before-app.ts b/apps/core/src/bootstrap/before-app.tsindex b8c8b70d14..abe2159503 100644--- a/apps/core/src/bootstrap/before-app.ts+++ b/apps/core/src/bootstrap/before-app.ts@@ -20,7 +20,7 @@ import {} from '@affine/workspace/migration';import { createIndexedDBDownloadProvider } from '@affine/workspace/providers';import { assertExists } from '@blocksuite/global/utils';-import { rootStore } from '@toeverything/plugin-infra/atom';+import { rootStore } from '@toeverything/infra/atom';import { WorkspaceAdapters } from '../adapters/workspace';diff --git a/apps/core/src/bootstrap/plugins/setup.ts b/apps/core/src/bootstrap/plugins/setup.tsindex 91f1aeb979..508f7dc0f9 100644--- a/apps/core/src/bootstrap/plugins/setup.ts+++ b/apps/core/src/bootstrap/plugins/setup.ts@@ -7,7 +7,6 @@ import * as BlockSuiteGlobalUtils from '@blocksuite/global/utils';import { assertExists } from '@blocksuite/global/utils';import { DisposableGroup } from '@blocksuite/global/utils';import * as Icons from '@blocksuite/icons';-import * as Atom from '@toeverything/plugin-infra/atom';import {contentLayoutAtom,currentPageAtom,@@ -17,7 +16,7 @@ import {rootStore,settingItemsAtom,windowItemsAtom,-} from '@toeverything/plugin-infra/atom';+} from '@toeverything/infra/atom';import * as Jotai from 'jotai/index';import { Provider } from 'jotai/react';import * as JotaiUtils from 'jotai/utils';@@ -62,10 +61,6 @@ const setupRootImportsMap = () => {);_rootImportsMap.set('jotai', new Map(Object.entries(Jotai)));_rootImportsMap.set('jotai/utils', new Map(Object.entries(JotaiUtils)));- _rootImportsMap.set(- '@toeverything/plugin-infra/atom',- new Map(Object.entries(Atom))- );_rootImportsMap.set('@affine/sdk/entry',new Map(diff --git a/apps/core/src/bootstrap/register-plugins.ts b/apps/core/src/bootstrap/register-plugins.tsindex afd62506b9..822118ce6e 100644--- a/apps/core/src/bootstrap/register-plugins.ts+++ b/apps/core/src/bootstrap/register-plugins.ts@@ -1,8 +1,5 @@import { DebugLogger } from '@affine/debug';-import {- registeredPluginAtom,- rootStore,-} from '@toeverything/plugin-infra/atom';+import { registeredPluginAtom, rootStore } from '@toeverything/infra/atom';import { evaluatePluginEntry, setupPluginCode } from './plugins/setup';diff --git a/apps/core/src/components/affine/affine-error-eoundary.tsx b/apps/core/src/components/affine/affine-error-eoundary.tsxindex 9f311b788b..a3ee12498d 100644--- a/apps/core/src/components/affine/affine-error-eoundary.tsx+++ b/apps/core/src/components/affine/affine-error-eoundary.tsx@@ -9,7 +9,7 @@ import {currentPageIdAtom,currentWorkspaceIdAtom,rootStore,-} from '@toeverything/plugin-infra/atom';+} from '@toeverything/infra/atom';import { useAtomValue } from 'jotai/react';import { Provider } from 'jotai/react';import type { ErrorInfo, ReactElement, ReactNode } from 'react';diff --git a/apps/core/src/components/affine/setting-modal/general-setting/plugins/index.tsx b/apps/core/src/components/affine/setting-modal/general-setting/plugins/index.tsxindex 9442a6624a..4c527ccd76 100644--- a/apps/core/src/components/affine/setting-modal/general-setting/plugins/index.tsx+++ b/apps/core/src/components/affine/setting-modal/general-setting/plugins/index.tsx@@ -3,7 +3,7 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks';import {registeredPluginAtom,settingItemsAtom,-} from '@toeverything/plugin-infra/atom';+} from '@toeverything/infra/atom';import { useAtomValue } from 'jotai';import type { FC, ReactNode } from 'react';import { useRef } from 'react';diff --git a/apps/core/src/components/affine/setting-modal/setting-sidebar/index.tsx b/apps/core/src/components/affine/setting-modal/setting-sidebar/index.tsxindex 7fc926bf4c..d3935750b8 100644--- a/apps/core/src/components/affine/setting-modal/setting-sidebar/index.tsx+++ b/apps/core/src/components/affine/setting-modal/setting-sidebar/index.tsx@@ -8,7 +8,7 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks';import type { RootWorkspaceMetadata } from '@affine/workspace/atom';import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom';import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name';-import { useStaticBlockSuiteWorkspace } from '@toeverything/plugin-infra/__internal__/react';+import { useStaticBlockSuiteWorkspace } from '@toeverything/infra/__internal__/react';import clsx from 'clsx';import { useAtomValue } from 'jotai';import type { FC } from 'react';diff --git a/apps/core/src/components/affine/setting-modal/workspace-setting/index.tsx b/apps/core/src/components/affine/setting-modal/workspace-setting/index.tsxindex c736c092a9..bda3c7fc7b 100644--- a/apps/core/src/components/affine/setting-modal/workspace-setting/index.tsx+++ b/apps/core/src/components/affine/setting-modal/workspace-setting/index.tsx@@ -1,5 +1,5 @@import { WorkspaceDetailSkeleton } from '@affine/component/setting-components';-import { usePassiveWorkspaceEffect } from '@toeverything/plugin-infra/__internal__/react';+import { usePassiveWorkspaceEffect } from '@toeverything/infra/__internal__/react';import { useSetAtom } from 'jotai';import { Suspense, useCallback } from 'react';diff --git a/apps/core/src/components/blocksuite/workspace-header/header-right-items/editor-option-menu.tsx b/apps/core/src/components/blocksuite/workspace-header/header-right-items/editor-option-menu.tsxindex 4c145ccf57..75511fd9d8 100644--- a/apps/core/src/components/blocksuite/workspace-header/header-right-items/editor-option-menu.tsx+++ b/apps/core/src/components/blocksuite/workspace-header/header-right-items/editor-option-menu.tsx@@ -14,7 +14,7 @@ import {useBlockSuitePageMeta,usePageMetaHelper,} from '@toeverything/hooks/use-block-suite-page-meta';-import { currentPageIdAtom } from '@toeverything/plugin-infra/atom';+import { currentPageIdAtom } from '@toeverything/infra/atom';import { useAtom, useAtomValue } from 'jotai';import { useCallback, useState } from 'react';import { useParams } from 'react-router-dom';diff --git a/apps/core/src/components/blocksuite/workspace-header/header-right-items/trash-button-group.tsx b/apps/core/src/components/blocksuite/workspace-header/header-right-items/trash-button-group.tsxindex bf42b0c523..8e2b0e6461 100644--- a/apps/core/src/components/blocksuite/workspace-header/header-right-items/trash-button-group.tsx+++ b/apps/core/src/components/blocksuite/workspace-header/header-right-items/trash-button-group.tsx@@ -3,7 +3,7 @@ import { WorkspaceSubPath } from '@affine/env/workspace';import { useAFFiNEI18N } from '@affine/i18n/hooks';import { assertExists } from '@blocksuite/global/utils';import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta';-import { currentPageIdAtom } from '@toeverything/plugin-infra/atom';+import { currentPageIdAtom } from '@toeverything/infra/atom';import { useAtomValue } from 'jotai';import { useCallback, useState } from 'react';diff --git a/apps/core/src/components/blocksuite/workspace-header/header.tsx b/apps/core/src/components/blocksuite/workspace-header/header.tsxindex 67cdcae9d3..7792ca7dce 100644--- a/apps/core/src/components/blocksuite/workspace-header/header.tsx+++ b/apps/core/src/components/blocksuite/workspace-header/header.tsx@@ -7,7 +7,7 @@ import { SidebarSwitch } from '@affine/component/app-sidebar/sidebar-header';import { isDesktop } from '@affine/env/constant';import { CloseIcon, MinusIcon, RoundedRectangleIcon } from '@blocksuite/icons';import type { Page } from '@blocksuite/store';-import { headerItemsAtom } from '@toeverything/plugin-infra/atom';+import { headerItemsAtom } from '@toeverything/infra/atom';import { useAtomValue } from 'jotai';import type { FC, HTMLAttributes, PropsWithChildren, ReactNode } from 'react';import {diff --git a/apps/core/src/components/page-detail-editor.tsx b/apps/core/src/components/page-detail-editor.tsxindex 1557235723..a5fd47a449 100644--- a/apps/core/src/components/page-detail-editor.tsx+++ b/apps/core/src/components/page-detail-editor.tsx@@ -13,7 +13,7 @@ import {editorItemsAtom,rootStore,windowItemsAtom,-} from '@toeverything/plugin-infra/atom';+} from '@toeverything/infra/atom';import clsx from 'clsx';import { useAtomValue, useSetAtom } from 'jotai';import type { CSSProperties, FC, ReactElement } from 'react';diff --git a/apps/core/src/hooks/current/use-current-workspace.ts b/apps/core/src/hooks/current/use-current-workspace.tsindex 4d782f27f6..0d71c7be9c 100644--- a/apps/core/src/hooks/current/use-current-workspace.ts+++ b/apps/core/src/hooks/current/use-current-workspace.ts@@ -2,7 +2,7 @@ import { assertExists } from '@blocksuite/global/utils';import {currentPageIdAtom,currentWorkspaceIdAtom,-} from '@toeverything/plugin-infra/atom';+} from '@toeverything/infra/atom';import { useAtom, useSetAtom } from 'jotai';import { useCallback, useEffect } from 'react';diff --git a/apps/core/src/hooks/root/use-on-transform-workspace.ts b/apps/core/src/hooks/root/use-on-transform-workspace.tsindex b875bf0373..88ea3e69aa 100644--- a/apps/core/src/hooks/root/use-on-transform-workspace.ts+++ b/apps/core/src/hooks/root/use-on-transform-workspace.ts@@ -1,6 +1,6 @@import type { WorkspaceRegistry } from '@affine/env/workspace';import type { WorkspaceFlavour } from '@affine/env/workspace';-import { currentPageIdAtom } from '@toeverything/plugin-infra/atom';+import { currentPageIdAtom } from '@toeverything/infra/atom';import { useSetAtom } from 'jotai';import { useCallback } from 'react';diff --git a/apps/core/src/hooks/use-navigate-helper.ts b/apps/core/src/hooks/use-navigate-helper.tsindex 1bed7cf6cf..9f74607452 100644--- a/apps/core/src/hooks/use-navigate-helper.ts+++ b/apps/core/src/hooks/use-navigate-helper.ts@@ -2,7 +2,7 @@ import type { WorkspaceSubPath } from '@affine/env/workspace';import {currentPageIdAtom,currentWorkspaceIdAtom,-} from '@toeverything/plugin-infra/atom';+} from '@toeverything/infra/atom';import { useSetAtom } from 'jotai';import { useCallback } from 'react';// eslint-disable-next-line @typescript-eslint/no-restricted-importsdiff --git a/apps/core/src/hooks/use-workspace.ts b/apps/core/src/hooks/use-workspace.tsindex 26a8d74a56..5ea3e26601 100644--- a/apps/core/src/hooks/use-workspace.ts+++ b/apps/core/src/hooks/use-workspace.ts@@ -1,7 +1,7 @@import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom';import { assertExists } from '@blocksuite/global/utils';import type { Workspace } from '@blocksuite/store';-import { useStaticBlockSuiteWorkspace } from '@toeverything/plugin-infra/__internal__/react';+import { useStaticBlockSuiteWorkspace } from '@toeverything/infra/__internal__/react';import type { Atom } from 'jotai';import { atom, useAtomValue } from 'jotai';diff --git a/apps/core/src/hooks/use-workspaces.ts b/apps/core/src/hooks/use-workspaces.tsindex 25c81356bb..477da8afdf 100644--- a/apps/core/src/hooks/use-workspaces.ts+++ b/apps/core/src/hooks/use-workspaces.ts@@ -7,7 +7,7 @@ import { saveWorkspaceToLocalStorage } from '@affine/workspace/local/crud';import { getOrCreateWorkspace } from '@affine/workspace/manager';import { assertEquals } from '@blocksuite/global/utils';import { nanoid } from '@blocksuite/store';-import { getWorkspace } from '@toeverything/plugin-infra/__internal__/workspace';+import { getWorkspace } from '@toeverything/infra/__internal__/workspace';import { useAtomValue, useSetAtom } from 'jotai';import { useCallback } from 'react';diff --git a/apps/core/src/layouts/workspace-layout.tsx b/apps/core/src/layouts/workspace-layout.tsxindex faeeb3794c..77aba356e5 100644--- a/apps/core/src/layouts/workspace-layout.tsx+++ b/apps/core/src/layouts/workspace-layout.tsx@@ -26,8 +26,8 @@ import {useSensor,useSensors,} from '@dnd-kit/core';-import { usePassiveWorkspaceEffect } from '@toeverything/plugin-infra/__internal__/react';-import { currentWorkspaceIdAtom } from '@toeverything/plugin-infra/atom';+import { usePassiveWorkspaceEffect } from '@toeverything/infra/__internal__/react';+import { currentWorkspaceIdAtom } from '@toeverything/infra/atom';import { useAtom, useAtomValue, useSetAtom } from 'jotai';import type { FC, PropsWithChildren, ReactElement } from 'react';import { lazy, Suspense, useCallback, useMemo } from 'react';diff --git a/apps/core/src/pages/index.tsx b/apps/core/src/pages/index.tsxindex f53b291232..110fa5d938 100644--- a/apps/core/src/pages/index.tsx+++ b/apps/core/src/pages/index.tsx@@ -1,7 +1,7 @@import { DebugLogger } from '@affine/debug';import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom';-import { getWorkspace } from '@toeverything/plugin-infra/__internal__/workspace';-import { rootStore } from '@toeverything/plugin-infra/atom';+import { getWorkspace } from '@toeverything/infra/__internal__/workspace';+import { rootStore } from '@toeverything/infra/atom';import { lazy } from 'react';import type { LoaderFunction } from 'react-router-dom';import { redirect } from 'react-router-dom';diff --git a/apps/core/src/pages/workspace/all-page.tsx b/apps/core/src/pages/workspace/all-page.tsxindex fea5b8e303..ad5d55b70c 100644--- a/apps/core/src/pages/workspace/all-page.tsx+++ b/apps/core/src/pages/workspace/all-page.tsx@@ -2,8 +2,8 @@ import { useCollectionManager } from '@affine/component/page-list';import { DEFAULT_HELLO_WORLD_PAGE_ID_SUFFIX } from '@affine/env/constant';import { WorkspaceSubPath } from '@affine/env/workspace';import { assertExists } from '@blocksuite/global/utils';-import { getActiveBlockSuiteWorkspaceAtom } from '@toeverything/plugin-infra/__internal__/workspace';-import { currentPageIdAtom, rootStore } from '@toeverything/plugin-infra/atom';+import { getActiveBlockSuiteWorkspaceAtom } from '@toeverything/infra/__internal__/workspace';+import { currentPageIdAtom, rootStore } from '@toeverything/infra/atom';import { useAtom } from 'jotai/react';import { useCallback, useEffect } from 'react';import type { LoaderFunction } from 'react-router-dom';diff --git a/apps/core/src/pages/workspace/detail-page.tsx b/apps/core/src/pages/workspace/detail-page.tsxindex a76b677196..f8af18d15c 100644--- a/apps/core/src/pages/workspace/detail-page.tsx+++ b/apps/core/src/pages/workspace/detail-page.tsx@@ -7,7 +7,7 @@ import { WorkspaceSubPath } from '@affine/env/workspace';import type { EditorContainer } from '@blocksuite/editor';import { assertExists } from '@blocksuite/global/utils';import type { Page } from '@blocksuite/store';-import { currentPageIdAtom, rootStore } from '@toeverything/plugin-infra/atom';+import { currentPageIdAtom, rootStore } from '@toeverything/infra/atom';import { useAtomValue } from 'jotai';import { useAtom } from 'jotai/react';import { type ReactElement, useCallback, useEffect } from 'react';diff --git a/apps/core/src/pages/workspace/index.tsx b/apps/core/src/pages/workspace/index.tsxindex aa8f68b361..d873286057 100644--- a/apps/core/src/pages/workspace/index.tsx+++ b/apps/core/src/pages/workspace/index.tsx@@ -1,8 +1,5 @@import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom';-import {- currentWorkspaceIdAtom,- rootStore,-} from '@toeverything/plugin-infra/atom';+import { currentWorkspaceIdAtom, rootStore } from '@toeverything/infra/atom';import type { ReactElement } from 'react';import { type LoaderFunction, Outlet, redirect } from 'react-router-dom';diff --git a/apps/core/src/providers/modal-provider.tsx b/apps/core/src/providers/modal-provider.tsxindex de7088bb9f..1e8d812c77 100644--- a/apps/core/src/providers/modal-provider.tsx+++ b/apps/core/src/providers/modal-provider.tsx@@ -5,7 +5,7 @@ import { arrayMove } from '@dnd-kit/sortable';import {currentPageIdAtom,currentWorkspaceIdAtom,-} from '@toeverything/plugin-infra/atom';+} from '@toeverything/infra/atom';import { useAtom, useAtomValue, useSetAtom } from 'jotai';import type { FC, ReactElement } from 'react';import { lazy, Suspense, useCallback, useTransition } from 'react';diff --git a/apps/electron/forge.config.js b/apps/electron/forge.config.jsindex 5a1007b8d1..8ee2fa6488 100644--- a/apps/electron/forge.config.js+++ b/apps/electron/forge.config.js@@ -121,17 +121,14 @@ module.exports = {const { rm, cp } = require('node:fs/promises');const { resolve } = require('node:path');- await rm(- resolve(__dirname, './node_modules/@toeverything/plugin-infra'),- {- recursive: true,- force: true,- }- );+ await rm(resolve(__dirname, './node_modules/@toeverything/infra'), {+ recursive: true,+ force: true,+ });await cp(- resolve(__dirname, '../../packages/plugin-infra'),- resolve(__dirname, './node_modules/@toeverything/plugin-infra'),+ resolve(__dirname, '../../packages/infra'),+ resolve(__dirname, './node_modules/@toeverything/infra'),{recursive: true,force: true,diff --git a/apps/electron/package.json b/apps/electron/package.jsonindex 79d515e0fe..3ee729df32 100644--- a/apps/electron/package.json+++ b/apps/electron/package.json@@ -41,7 +41,6 @@"@electron-forge/shared-types": "^6.2.1","@electron/remote": "2.0.10","@reforged/maker-appimage": "^3.3.1",- "@toeverything/infra": "workspace:*","@types/fs-extra": "^11.0.1","@types/uuid": "^9.0.2","cross-env": "7.0.3",@@ -60,7 +59,7 @@"zx": "^7.2.3"},"dependencies": {- "@toeverything/plugin-infra": "workspace:*",+ "@toeverything/infra": "workspace:*","async-call-rpc": "^6.3.1","electron-updater": "^6.0.0","link-preview-js": "^3.0.4",diff --git a/apps/electron/tsconfig.json b/apps/electron/tsconfig.jsonindex 344f065001..9dbd4efb7a 100644--- a/apps/electron/tsconfig.json+++ b/apps/electron/tsconfig.json@@ -17,7 +17,7 @@"exclude": ["node_modules", "out", "dist", "**/__tests__/**/*"],"references": [{- "path": "../../packages/plugin-infra"+ "path": "../../packages/infra"},{"path": "../../packages/native"diff --git a/nx.json b/nx.jsonindex 831f03543f..ea2b2bb11f 100644--- a/nx.json+++ b/nx.json@@ -38,6 +38,8 @@"{workspaceRoot}/apps/core/public/plugins"],"inputs": [+ "{workspaceRoot}/infra/**/*",+ "{workspaceRoot}/sdk/**/*",{"runtime": "node -v"},diff --git a/package.json b/package.jsonindex 6206f85425..e8d0504ec9 100644--- a/package.json+++ b/package.json@@ -24,7 +24,7 @@"build": "yarn nx build @affine/core","build:electron": "yarn nx build @affine/electron","build:storage": "yarn nx run-many -t build -p @affine/storage",- "build:infra": "yarn nx run-many -t build -p plugin-infra infra sdk",+ "build:infra": "yarn nx run-many -t build -p infra sdk","build:plugins": "yarn nx run-many -t build --projects=tag:plugin","build:storybook": "yarn nx build @affine/storybook","start:web-static": "yarn workspace @affine/core static-server",@@ -70,7 +70,6 @@"@taplo/cli": "^0.5.2","@testing-library/react": "^14.0.0","@toeverything/infra": "workspace:*",- "@toeverything/plugin-infra": "workspace:*","@types/eslint": "^8.44.1","@types/node": "^18.17.1","@typescript-eslint/eslint-plugin": "^6.2.0",diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.jsonindex 718b013154..526b46bc0f 100644--- a/packages/cli/tsconfig.json+++ b/packages/cli/tsconfig.json@@ -9,7 +9,7 @@"include": ["src"],"references": [{- "path": "../plugin-infra"+ "path": "../infra"}]}diff --git a/packages/component/package.json b/packages/component/package.jsonindex b1d2b5572e..09d6883894 100644--- a/packages/component/package.json+++ b/packages/component/package.json@@ -36,7 +36,6 @@"@radix-ui/react-scroll-area": "^1.0.4","@radix-ui/react-toast": "^1.1.4","@toeverything/hooks": "workspace:*",- "@toeverything/plugin-infra": "workspace:*","@toeverything/theme": "^0.7.9","@vanilla-extract/dynamic": "^2.0.3","clsx": "^2.0.0",diff --git a/packages/component/src/components/card/workspace-card/index.tsx b/packages/component/src/components/card/workspace-card/index.tsxindex b54d2d168b..37c99d7a44 100644--- a/packages/component/src/components/card/workspace-card/index.tsx+++ b/packages/component/src/components/card/workspace-card/index.tsx@@ -9,7 +9,7 @@ import {LocalWorkspaceIcon as DefaultLocalWorkspaceIcon,} from '@blocksuite/icons';import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name';-import { useStaticBlockSuiteWorkspace } from '@toeverything/plugin-infra/__internal__/react';+import { useStaticBlockSuiteWorkspace } from '@toeverything/infra/__internal__/react';import type { FC } from 'react';import { useCallback } from 'react';diff --git a/packages/component/src/components/context/index.tsx b/packages/component/src/components/context/index.tsxindex 40444e322c..4880279d1c 100644--- a/packages/component/src/components/context/index.tsx+++ b/packages/component/src/components/context/index.tsx@@ -1,6 +1,6 @@import { ProviderComposer } from '@affine/component/provider-composer';import { ThemeProvider } from '@affine/component/theme-provider';-import { rootStore } from '@toeverything/plugin-infra/atom';+import { rootStore } from '@toeverything/infra/atom';import { Provider } from 'jotai';import type { PropsWithChildren } from 'react';import { useMemo } from 'react';diff --git a/packages/component/tsconfig.json b/packages/component/tsconfig.jsonindex dcf7817330..6f3567d6a3 100644--- a/packages/component/tsconfig.json+++ b/packages/component/tsconfig.json@@ -22,7 +22,7 @@"path": "../hooks"},{- "path": "../plugin-infra"+ "path": "../infra"},{ "path": "../workspace" },{ "path": "../../tests/fixtures" }diff --git a/packages/infra/package.json b/packages/infra/package.jsonindex a0a804bf8b..b2e46183c7 100644--- a/packages/infra/package.json+++ b/packages/infra/package.json@@ -19,6 +19,26 @@"types": "./dist/src/preload/*.d.ts","import": "./dist/preload/*.js","require": "./dist/preload/*.cjs"+ },+ "./atom": {+ "type": "./dist/src/atom.d.ts",+ "import": "./dist/atom.js",+ "require": "./dist/atom.cjs"+ },+ "./type": {+ "type": "./dist/src/type.d.ts",+ "import": "./dist/type.js",+ "require": "./dist/type.cjs"+ },+ "./__internal__/workspace": {+ "type": "./dist/src/__internal__/workspace.d.ts",+ "import": "./dist/__internal__/workspace.js",+ "require": "./dist/__internal__/workspace.cjs"+ },+ "./__internal__/react": {+ "type": "./dist/src/__internal__/react.d.ts",+ "import": "./dist/__internal__/react.js",+ "require": "./dist/__internal__/react.cjs"}},"files": [@@ -28,22 +48,43 @@"build": "vite build","dev": "vite build --watch"},+ "dependencies": {+ "@affine/sdk": "workspace:*",+ "@blocksuite/blocks": "0.0.0-20230802200139-381599c0-nightly",+ "@blocksuite/global": "0.0.0-20230802200139-381599c0-nightly",+ "@blocksuite/store": "0.0.0-20230802200139-381599c0-nightly",+ "jotai": "^2.2.2",+ "zod": "^3.21.4"+ },"devDependencies": {+ "@blocksuite/editor": "0.0.0-20230802200139-381599c0-nightly",+ "@blocksuite/lit": "0.0.0-20230802200139-381599c0-nightly","async-call-rpc": "^6.3.1","electron": "link:../../apps/electron/node_modules/electron",+ "react": "^18.2.0","vite": "^4.4.7","vite-plugin-dts": "3.3.1"},"peerDependencies": {"async-call-rpc": "*",- "electron": "*"+ "electron": "*",+ "react": "*"},"peerDependenciesMeta": {+ "@blocksuite/editor": {+ "optional": true+ },+ "@blocksuite/lit": {+ "optional": true+ },"async-call-rpc": {"optional": true},"electron": {"optional": true+ },+ "react": {+ "optional": true}},"version": "0.8.0-canary.8"diff --git a/packages/plugin-infra/src/__internal__/react.ts b/packages/infra/src/__internal__/react.tssimilarity index 100%rename from packages/plugin-infra/src/__internal__/react.tsrename to packages/infra/src/__internal__/react.tsdiff --git a/packages/plugin-infra/src/__internal__/workspace.ts b/packages/infra/src/__internal__/workspace.tssimilarity index 100%rename from packages/plugin-infra/src/__internal__/workspace.tsrename to packages/infra/src/__internal__/workspace.tsdiff --git a/packages/plugin-infra/src/__tests__/use-block-suite-workspace.spec.ts b/packages/infra/src/__tests__/use-block-suite-workspace.spec.tssimilarity index 100%rename from packages/plugin-infra/src/__tests__/use-block-suite-workspace.spec.tsrename to packages/infra/src/__tests__/use-block-suite-workspace.spec.tsdiff --git a/packages/plugin-infra/src/atom.ts b/packages/infra/src/atom.tssimilarity index 100%rename from packages/plugin-infra/src/atom.tsrename to packages/infra/src/atom.tsdiff --git a/packages/infra/src/type.ts b/packages/infra/src/type.tsindex a82136c141..a3334da36a 100644--- a/packages/infra/src/type.ts+++ b/packages/infra/src/type.ts@@ -1,5 +1,45 @@+import type { ExpectedLayout } from '@affine/sdk/entry';+import type { WritableAtom } from 'jotai';+import { z } from 'zod';+import type { TypedEventEmitter } from './core/event-emitter.js';+export const packageJsonInputSchema = z.object({+ name: z.string(),+ version: z.string(),+ description: z.string(),+ affinePlugin: z.object({+ release: z.boolean(),+ entry: z.object({+ core: z.string(),+ server: z.string().optional(),+ }),+ serverCommand: z.array(z.string()).optional(),+ }),+});++export const packageJsonOutputSchema = z.object({+ name: z.string(),+ version: z.string(),+ description: z.string(),+ affinePlugin: z.object({+ release: z.boolean(),+ entry: z.object({+ core: z.string(),+ }),+ assets: z.array(z.string()),+ serverCommand: z.array(z.string()).optional(),+ }),+});++type SetStateAction<Value> = Value | ((prev: Value) => Value);++export type ContentLayoutAtom = WritableAtom<+ ExpectedLayout,+ [SetStateAction<ExpectedLayout>],+ void+>;+export abstract class HandlerManager<Namespace extends string,Handlers extends Record<string, PrimitiveHandlers>,diff --git a/packages/infra/vite.config.ts b/packages/infra/vite.config.tsindex ab5edba320..a920b0ede4 100644--- a/packages/infra/vite.config.ts+++ b/packages/infra/vite.config.ts@@ -12,14 +12,29 @@ export default defineConfig({lib: {entry: {index: resolve(root, 'src/index.ts'),+ atom: resolve(root, 'src/atom.ts'),+ type: resolve(root, 'src/type.ts'),'core/event-emitter': resolve(root, 'src/core/event-emitter.ts'),'preload/electron': resolve(root, 'src/preload/electron.ts'),+ '__internal__/workspace': resolve(+ root,+ 'src/__internal__/workspace.ts'+ ),+ '__internal__/react': resolve(root, 'src/__internal__/react.ts'),},formats: ['es', 'cjs'],name: 'AffineInfra',},rollupOptions: {- external: ['electron', 'async-call-rpc', 'rxjs'],+ external: [+ 'electron',+ 'async-call-rpc',+ 'rxjs',+ 'zod',+ 'react',+ /^jotai/,+ /^@blocksuite/,+ ],},},plugins: [dts()],diff --git a/packages/plugin-cli/package.json b/packages/plugin-cli/package.jsonindex 34490c4cd9..bf1f409fca 100644--- a/packages/plugin-cli/package.json+++ b/packages/plugin-cli/package.json@@ -12,7 +12,7 @@"dependencies": {"@endo/static-module-record": "^0.7.20","@swc/core": "^1.3.72",- "@toeverything/plugin-infra": "workspace:^",+ "@toeverything/infra": "workspace:^","@vanilla-extract/rollup-plugin": "^1.2.2","rollup": "^3.27.0","rollup-plugin-swc3": "^0.9.1",diff --git a/packages/plugin-cli/src/af.ts b/packages/plugin-cli/src/af.tsindex 93e15ad2ac..c2b8ff2ed6 100644--- a/packages/plugin-cli/src/af.ts+++ b/packages/plugin-cli/src/af.ts@@ -8,7 +8,7 @@ import { StaticModuleRecord } from '@endo/static-module-record';import {packageJsonInputSchema,packageJsonOutputSchema,-} from '@toeverything/plugin-infra/type';+} from '@toeverything/infra/type';import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';import react from '@vitejs/plugin-react-swc';import { build, type PluginOption } from 'vite';diff --git a/packages/plugin-cli/tsconfig.json b/packages/plugin-cli/tsconfig.jsonindex 718b013154..526b46bc0f 100644--- a/packages/plugin-cli/tsconfig.json+++ b/packages/plugin-cli/tsconfig.json@@ -9,7 +9,7 @@"include": ["src"],"references": [{- "path": "../plugin-infra"+ "path": "../infra"}]}diff --git a/packages/plugin-infra/package.json b/packages/plugin-infra/package.jsondeleted file mode 100644index 529bfa98fc..0000000000--- a/packages/plugin-infra/package.json+++ /dev/null@@ -1,60 +0,0 @@-{- "name": "@toeverything/plugin-infra",- "type": "module",- "scripts": {- "build": "vite build",- "dev": "vite build --watch"- },- "files": [- "dist"- ],- "exports": {- "./entry": {- "type": "./dist/src/entry.d.ts",- "import": "./dist/entry.js",- "require": "./dist/entry.cjs"- },- "./atom": {- "type": "./dist/src/atom.d.ts",- "import": "./dist/atom.js",- "require": "./dist/atom.cjs"- },- "./type": {- "type": "./dist/src/type.d.ts",- "import": "./dist/type.js",- "require": "./dist/type.cjs"- },- "./__internal__/workspace": {- "type": "./dist/src/__internal__/workspace.d.ts",- "import": "./dist/__internal__/workspace.js",- "require": "./dist/__internal__/workspace.cjs"- },- "./__internal__/react": {- "type": "./dist/src/__internal__/react.d.ts",- "import": "./dist/__internal__/react.js",- "require": "./dist/__internal__/react.cjs"- }- },- "dependencies": {- "@affine/sdk": "workspace:*",- "@blocksuite/global": "0.0.0-20230802200139-381599c0-nightly",- "@blocksuite/store": "0.0.0-20230802200139-381599c0-nightly",- "jotai": "^2.2.2",- "zod": "^3.21.4"- },- "devDependencies": {- "@blocksuite/blocks": "0.0.0-20230802200139-381599c0-nightly",- "@blocksuite/editor": "0.0.0-20230802200139-381599c0-nightly",- "@blocksuite/lit": "0.0.0-20230802200139-381599c0-nightly",- "vite": "^4.4.7",- "vite-plugin-dts": "3.3.1"- },- "peerDependencies": {- "@blocksuite/blocks": "*",- "@blocksuite/editor": "*",- "@blocksuite/lit": "*",- "react": "*",- "react-dom": "*"- },- "version": "0.8.0-canary.8"-}diff --git a/packages/plugin-infra/project.json b/packages/plugin-infra/project.jsondeleted file mode 100644index 1d6f16d6ee..0000000000--- a/packages/plugin-infra/project.json+++ /dev/null@@ -1,21 +0,0 @@-{- "name": "plugin-infra",- "$schema": "../../node_modules/nx/schemas/project-schema.json",- "projectType": "library",- "sourceRoot": "packages/plugin-infra/src",- "targets": {- "build": {- "executor": "@nx/vite:build",- "options": {- "outputPath": "packages/plugin-infra/dist"- }- },- "serve": {- "executor": "@nx/vite:build",- "options": {- "outputPath": "packages/plugin-infra/dist",- "watch": true- }- }- }-}diff --git a/packages/plugin-infra/src/type.ts b/packages/plugin-infra/src/type.tsdeleted file mode 100644index 1c0df9b993..0000000000--- a/packages/plugin-infra/src/type.ts+++ /dev/null@@ -1,39 +0,0 @@-import type { ExpectedLayout } from '@affine/sdk/entry';-import type { WritableAtom } from 'jotai';-import { z } from 'zod';--export const packageJsonInputSchema = z.object({- name: z.string(),- version: z.string(),- description: z.string(),- affinePlugin: z.object({- release: z.boolean(),- entry: z.object({- core: z.string(),- server: z.string().optional(),- }),- serverCommand: z.array(z.string()).optional(),- }),-});--export const packageJsonOutputSchema = z.object({- name: z.string(),- version: z.string(),- description: z.string(),- affinePlugin: z.object({- release: z.boolean(),- entry: z.object({- core: z.string(),- }),- assets: z.array(z.string()),- serverCommand: z.array(z.string()).optional(),- }),-});--type SetStateAction<Value> = Value | ((prev: Value) => Value);--export type ContentLayoutAtom = WritableAtom<- ExpectedLayout,- [SetStateAction<ExpectedLayout>],- void->;diff --git a/packages/plugin-infra/tsconfig.json b/packages/plugin-infra/tsconfig.jsondeleted file mode 100644index fc88b250ac..0000000000--- a/packages/plugin-infra/tsconfig.json+++ /dev/null@@ -1,15 +0,0 @@-{- "extends": "../../tsconfig.json",- "include": ["./src"],- "compilerOptions": {- "composite": true,- "noEmit": false,- "outDir": "lib",- "moduleResolution": "node16"- },- "references": [- {- "path": "./tsconfig.node.json"- }- ]-}diff --git a/packages/plugin-infra/tsconfig.node.json b/packages/plugin-infra/tsconfig.node.jsondeleted file mode 100644index e66abbb359..0000000000--- a/packages/plugin-infra/tsconfig.node.json+++ /dev/null@@ -1,10 +0,0 @@-{- "extends": "../../tsconfig.json",- "compilerOptions": {- "composite": true,- "module": "ESNext",- "moduleResolution": "Node",- "outDir": "lib"- },- "include": ["vite.config.ts"]-}diff --git a/packages/plugin-infra/vite.config.ts b/packages/plugin-infra/vite.config.tsdeleted file mode 100644index d2f110482a..0000000000--- a/packages/plugin-infra/vite.config.ts+++ /dev/null@@ -1,28 +0,0 @@-import { resolve } from 'node:path';--import { fileURLToPath } from 'url';-import { defineConfig } from 'vite';-import dts from 'vite-plugin-dts';--const root = fileURLToPath(new URL('.', import.meta.url));--export default defineConfig({- build: {- minify: false,- lib: {- entry: {- type: resolve(root, 'src/type.ts'),- atom: resolve(root, 'src/atom.ts'),- '__internal__/workspace': resolve(- root,- 'src/__internal__/workspace.ts'- ),- '__internal__/react': resolve(root, 'src/__internal__/react.ts'),- },- },- rollupOptions: {- external: ['react', /^jotai/, /^@blocksuite/, 'zod'],- },- },- plugins: [dts()],-});diff --git a/packages/workspace/package.json b/packages/workspace/package.jsonindex e9fbb9f95a..855c94edcd 100644--- a/packages/workspace/package.json+++ b/packages/workspace/package.json@@ -18,7 +18,6 @@"@affine/debug": "workspace:*","@affine/env": "workspace:*","@toeverything/hooks": "workspace:*",- "@toeverything/plugin-infra": "workspace:*","@toeverything/y-indexeddb": "workspace:*","async-call-rpc": "^6.3.1","jotai": "^2.2.2",diff --git a/packages/workspace/src/manager/index.ts b/packages/workspace/src/manager/index.tsindex ad48e55770..96d5a890e3 100644--- a/packages/workspace/src/manager/index.ts+++ b/packages/workspace/src/manager/index.ts@@ -8,7 +8,7 @@ import {Generator,Workspace,} from '@blocksuite/store';-import { INTERNAL_BLOCKSUITE_HASH_MAP } from '@toeverything/plugin-infra/__internal__/workspace';+import { INTERNAL_BLOCKSUITE_HASH_MAP } from '@toeverything/infra/__internal__/workspace';import type { Doc } from 'yjs';import type { Transaction } from 'yjs';diff --git a/packages/workspace/tsconfig.json b/packages/workspace/tsconfig.jsonindex 57d5f932ad..2cd5443c4f 100644--- a/packages/workspace/tsconfig.json+++ b/packages/workspace/tsconfig.json@@ -11,6 +11,6 @@{ "path": "../env" },{ "path": "../debug" },{ "path": "../hooks" },- { "path": "../plugin-infra" }+ { "path": "../infra" }]}diff --git a/plugins/copilot/src/UI/header-item.tsx b/plugins/copilot/src/UI/header-item.tsxindex 4a50670ecc..56e57f7d6b 100644--- a/plugins/copilot/src/UI/header-item.tsx+++ b/plugins/copilot/src/UI/header-item.tsx@@ -1,5 +1,5 @@import { IconButton, Tooltip } from '@affine/component';-import { contentLayoutAtom } from '@toeverything/plugin-infra/atom';+import { contentLayoutAtom } from '@affine/sdk/entry';import { useSetAtom } from 'jotai';import type { ReactElement } from 'react';import { useCallback } from 'react';diff --git a/plugins/hello-world/package.json b/plugins/hello-world/package.jsonindex 7ab9d2f484..172d293ba4 100644--- a/plugins/hello-world/package.json+++ b/plugins/hello-world/package.json@@ -17,8 +17,7 @@"dependencies": {"@affine/component": "workspace:*","@affine/sdk": "workspace:*",- "@blocksuite/icons": "^2.1.29",- "@toeverything/plugin-infra": "workspace:*"+ "@blocksuite/icons": "^2.1.29"},"devDependencies": {"@affine/plugin-cli": "workspace:*"diff --git a/scripts/publish.sh b/scripts/publish.shindex 56a4a02c08..9d3ae5a9d2 100755--- a/scripts/publish.sh+++ b/scripts/publish.sh@@ -3,7 +3,6 @@packages=("y-indexeddb""infra"- "plugin-infra""sdk")diff --git a/tsconfig.json b/tsconfig.jsonindex 1b08cdafc8..0cb3c5de95 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -76,7 +76,6 @@"@toeverything/y-indexeddb": ["./packages/y-indexeddb/src"],"@toeverything/hooks/*": ["./packages/hooks/src/*"],"@toeverything/infra/*": ["./packages/infra/src/*"],- "@toeverything/plugin-infra/*": ["./packages/plugin-infra/src/*"],"@affine/sdk/*": ["./packages/sdk/src/*"],"@affine/native": ["./packages/native/index.d.ts"],"@affine/native/*": ["./packages/native/*"],@@ -105,9 +104,6 @@{"path": "./packages/infra"},- {- "path": "./packages/plugin-infra"- },{"path": "./packages/graphql"},diff --git a/yarn.lock b/yarn.lockindex edbcaef966..1d8a4281ee 100644--- a/yarn.lock+++ b/yarn.lock@@ -148,7 +148,6 @@ __metadata:"@radix-ui/react-scroll-area": ^1.0.4"@radix-ui/react-toast": ^1.1.4"@toeverything/hooks": "workspace:*"- "@toeverything/plugin-infra": "workspace:*""@toeverything/theme": ^0.7.9"@types/react": ^18.2.17"@types/react-datepicker": ^4.15.0@@ -336,7 +335,6 @@ __metadata:"@electron/remote": 2.0.10"@reforged/maker-appimage": ^3.3.1"@toeverything/infra": "workspace:*"- "@toeverything/plugin-infra": "workspace:*""@types/fs-extra": ^11.0.1"@types/uuid": ^9.0.2async-call-rpc: ^6.3.1@@ -404,7 +402,6 @@ __metadata:"@affine/plugin-cli": "workspace:*""@affine/sdk": "workspace:*""@blocksuite/icons": ^2.1.29- "@toeverything/plugin-infra": "workspace:*"languageName: unknownlinkType: soft@@ -491,7 +488,6 @@ __metadata:"@taplo/cli": ^0.5.2"@testing-library/react": ^14.0.0"@toeverything/infra": "workspace:*"- "@toeverything/plugin-infra": "workspace:*""@types/eslint": ^8.44.1"@types/node": ^18.17.1"@typescript-eslint/eslint-plugin": ^6.2.0@@ -557,7 +553,7 @@ __metadata:dependencies:"@endo/static-module-record": ^0.7.20"@swc/core": ^1.3.72- "@toeverything/plugin-infra": "workspace:^"+ "@toeverything/infra": "workspace:^""@vanilla-extract/rollup-plugin": ^1.2.2rollup: ^3.27.0rollup-plugin-swc3: ^0.9.1@@ -706,7 +702,6 @@ __metadata:"@affine/debug": "workspace:*""@affine/env": "workspace:*""@toeverything/hooks": "workspace:*"- "@toeverything/plugin-infra": "workspace:*""@toeverything/y-indexeddb": "workspace:*""@types/ws": ^8.5.5async-call-rpc: ^6.3.1@@ -11389,28 +11384,9 @@ __metadata:languageName: unknownlinkType: soft-"@toeverything/infra@workspace:*, @toeverything/infra@workspace:packages/infra":+"@toeverything/infra@workspace:*, @toeverything/infra@workspace:^, @toeverything/infra@workspace:packages/infra":version: 0.0.0-use.localresolution: "@toeverything/infra@workspace:packages/infra"- dependencies:- async-call-rpc: ^6.3.1- electron: "link:../../apps/electron/node_modules/electron"- vite: ^4.4.7- vite-plugin-dts: 3.3.1- peerDependencies:- async-call-rpc: "*"- electron: "*"- peerDependenciesMeta:- async-call-rpc:- optional: true- electron:- optional: true- languageName: unknown- linkType: soft--"@toeverything/plugin-infra@workspace:*, @toeverything/plugin-infra@workspace:^, @toeverything/plugin-infra@workspace:packages/plugin-infra":- version: 0.0.0-use.local- resolution: "@toeverything/plugin-infra@workspace:packages/plugin-infra"dependencies:"@affine/sdk": "workspace:*""@blocksuite/blocks": 0.0.0-20230802200139-381599c0-nightly@@ -11418,16 +11394,28 @@ __metadata:"@blocksuite/global": 0.0.0-20230802200139-381599c0-nightly"@blocksuite/lit": 0.0.0-20230802200139-381599c0-nightly"@blocksuite/store": 0.0.0-20230802200139-381599c0-nightly+ async-call-rpc: ^6.3.1+ electron: "link:../../apps/electron/node_modules/electron"jotai: ^2.2.2+ react: ^18.2.0vite: ^4.4.7vite-plugin-dts: 3.3.1zod: ^3.21.4peerDependencies:- "@blocksuite/blocks": "*"- "@blocksuite/editor": "*"- "@blocksuite/lit": "*"+ async-call-rpc: "*"+ electron: "*"react: "*"- react-dom: "*"+ peerDependenciesMeta:+ "@blocksuite/editor":+ optional: true+ "@blocksuite/lit":+ optional: true+ async-call-rpc:+ optional: true+ electron:+ optional: true+ react:+ optional: truelanguageName: unknownlinkType: soft@@ -27687,7 +27675,7 @@ __metadata:languageName: nodelinkType: hard-"react@npm:18.2.0":+"react@npm:18.2.0, react@npm:^18.2.0":version: 18.2.0resolution: "react@npm:18.2.0"dependencies: