refactor: merge plugin-infra into infra (#3540)

This commit is contained in:
Alex Yang
2023-08-03 01:48:59 -07:00
committed by GitHub
parent 3282344d4a
commit 0e32803247
62 changed files with 169 additions and 284 deletions
-1
View File
@@ -24,7 +24,6 @@
"debug",
"storage",
"infra",
"plugin-infra",
"plugin-cli",
"sdk"
]
+2 -1
View File
@@ -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',
-1
View File
@@ -23,7 +23,6 @@ plugin:copilot:
- 'plugins/copilot/**/*'
mod:infra:
- 'packages/plugin-infra/**/*'
- 'packages/infra/**/*'
mod:sdk:
+1 -4
View File
@@ -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';
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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';
+1 -1
View File
@@ -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';
+1 -6
View File
@@ -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(
+1 -4
View File
@@ -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';
@@ -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';
@@ -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';
@@ -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';
@@ -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';
@@ -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';
@@ -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';
@@ -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 {
@@ -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';
@@ -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';
@@ -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';
+1 -1
View File
@@ -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-imports
+1 -1
View File
@@ -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';
+1 -1
View File
@@ -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';
+2 -2
View File
@@ -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';
+2 -2
View File
@@ -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';
+2 -2
View File
@@ -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';
@@ -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';
+1 -4
View File
@@ -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';
+1 -1
View File
@@ -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';
+6 -9
View File
@@ -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,
+1 -2
View File
@@ -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",
+1 -1
View File
@@ -17,7 +17,7 @@
"exclude": ["node_modules", "out", "dist", "**/__tests__/**/*"],
"references": [
{
"path": "../../packages/plugin-infra"
"path": "../../packages/infra"
},
{
"path": "../../packages/native"
+2
View File
@@ -38,6 +38,8 @@
"{workspaceRoot}/apps/core/public/plugins"
],
"inputs": [
"{workspaceRoot}/infra/**/*",
"{workspaceRoot}/sdk/**/*",
{
"runtime": "node -v"
},
+1 -2
View File
@@ -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",
+1 -1
View File
@@ -9,7 +9,7 @@
"include": ["src"],
"references": [
{
"path": "../plugin-infra"
"path": "../infra"
}
]
}
-1
View File
@@ -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",
@@ -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';
@@ -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';
+1 -1
View File
@@ -22,7 +22,7 @@
"path": "../hooks"
},
{
"path": "../plugin-infra"
"path": "../infra"
},
{ "path": "../workspace" },
{ "path": "../../tests/fixtures" }
+42 -1
View File
@@ -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"
+40
View File
@@ -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>,
+16 -1
View File
@@ -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()],
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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';
+1 -1
View File
@@ -9,7 +9,7 @@
"include": ["src"],
"references": [
{
"path": "../plugin-infra"
"path": "../infra"
}
]
}
-60
View File
@@ -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"
}
-21
View File
@@ -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
}
}
}
}
-39
View File
@@ -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
>;
-15
View File
@@ -1,15 +0,0 @@
{
"extends": "../../tsconfig.json",
"include": ["./src"],
"compilerOptions": {
"composite": true,
"noEmit": false,
"outDir": "lib",
"moduleResolution": "node16"
},
"references": [
{
"path": "./tsconfig.node.json"
}
]
}
-10
View File
@@ -1,10 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"outDir": "lib"
},
"include": ["vite.config.ts"]
}
-28
View File
@@ -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()],
});
-1
View File
@@ -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",
+1 -1
View File
@@ -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';
+1 -1
View File
@@ -11,6 +11,6 @@
{ "path": "../env" },
{ "path": "../debug" },
{ "path": "../hooks" },
{ "path": "../plugin-infra" }
{ "path": "../infra" }
]
}
+1 -1
View File
@@ -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';
+1 -2
View File
@@ -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:*"
-1
View File
@@ -3,7 +3,6 @@
packages=(
"y-indexeddb"
"infra"
"plugin-infra"
"sdk"
)
-4
View File
@@ -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"
},
+19 -31
View File
@@ -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.2
async-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: unknown
linkType: 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.2
rollup: ^3.27.0
rollup-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.5
async-call-rpc: ^6.3.1
@@ -11389,28 +11384,9 @@ __metadata:
languageName: unknown
linkType: 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.local
resolution: "@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.0
vite: ^4.4.7
vite-plugin-dts: 3.3.1
zod: ^3.21.4
peerDependencies:
"@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: true
languageName: unknown
linkType: soft
@@ -27687,7 +27675,7 @@ __metadata:
languageName: node
linkType: hard
"react@npm:18.2.0":
"react@npm:18.2.0, react@npm:^18.2.0":
version: 18.2.0
resolution: "react@npm:18.2.0"
dependencies: