diff --git a/.commitlintrc.json b/.commitlintrc.json index 72ebb37640..e08e9c6a5f 100644 --- a/.commitlintrc.json +++ b/.commitlintrc.json @@ -25,7 +25,8 @@ "storage", "infra", "plugin-infra", - "plugin-cli" + "plugin-cli", + "sdk" ] ] } diff --git a/.eslintignore b/.eslintignore index bf749d8a16..fd3129ad98 100644 --- a/.eslintignore +++ b/.eslintignore @@ -9,3 +9,6 @@ lib .eslintrc.js packages/i18n/src/i18n-generated.ts e2e-dist-* +static +web-static +public diff --git a/.github/labeler.yml b/.github/labeler.yml index 8a272e2f5d..8308388b27 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -22,8 +22,12 @@ plugin:bookmark-block: plugin:copilot: - 'plugins/copilot/**/*' -mod:plugin-infra: +mod:infra: - 'packages/plugin-infra/**/*' + - 'packages/infra/**/*' + +mod:sdk: + - 'packages/sdk/**/*' mod:plugin-cli: - 'packages/plugin-cli/**/*' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c36de203da..f862d0738c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,8 +47,6 @@ jobs: electron-install: false - name: Run i18n codegen run: yarn i18n-codegen gen - - name: Run Type Check - run: yarn typecheck - name: Run ESLint run: yarn lint:eslint --max-warnings=0 - name: Run Prettier @@ -58,12 +56,8 @@ jobs: yarn lint:prettier - name: Run circular run: yarn circular - - name: Upload server dist - uses: actions/upload-artifact@v3 - with: - name: server-dist - path: ./apps/server/dist - if-no-files-found: error + - name: Run Type Check + run: yarn typecheck build-docs: name: Build Docs @@ -490,7 +484,6 @@ jobs: if: github.ref == 'refs/heads/master' name: Build Docker needs: - - lint - desktop-test - server-test runs-on: ubuntu-latest @@ -501,11 +494,9 @@ jobs: with: name: core path: ./apps/core/dist - - name: Download server dist - uses: actions/download-artifact@v3 - with: - name: server-dist - path: ./apps/server/dist + - name: Compile server code + run: tsc -b + working-directory: ./apps/server - name: Download storage.node uses: actions/download-artifact@v3 with: diff --git a/apps/core/src/bootstrap/plugins/setup.ts b/apps/core/src/bootstrap/plugins/setup.ts index b2b6cdb6cf..91f1aeb979 100644 --- a/apps/core/src/bootstrap/plugins/setup.ts +++ b/apps/core/src/bootstrap/plugins/setup.ts @@ -1,5 +1,6 @@ import * as AFFiNEComponent from '@affine/component'; import { DebugLogger } from '@affine/debug'; +import type { CallbackMap, PluginContext } from '@affine/sdk/entry'; import { FormatQuickBar } from '@blocksuite/blocks'; import * as BlockSuiteBlocksStd from '@blocksuite/blocks/std'; import * as BlockSuiteGlobalUtils from '@blocksuite/global/utils'; @@ -8,16 +9,15 @@ import { DisposableGroup } from '@blocksuite/global/utils'; import * as Icons from '@blocksuite/icons'; import * as Atom from '@toeverything/plugin-infra/atom'; import { + contentLayoutAtom, + currentPageAtom, + currentWorkspaceAtom, editorItemsAtom, headerItemsAtom, rootStore, settingItemsAtom, windowItemsAtom, } from '@toeverything/plugin-infra/atom'; -import type { - CallbackMap, - PluginContext, -} from '@toeverything/plugin-infra/entry'; import * as Jotai from 'jotai/index'; import { Provider } from 'jotai/react'; import * as JotaiUtils from 'jotai/utils'; @@ -66,6 +66,17 @@ const setupRootImportsMap = () => { '@toeverything/plugin-infra/atom', new Map(Object.entries(Atom)) ); + _rootImportsMap.set( + '@affine/sdk/entry', + new Map( + Object.entries({ + rootStore: rootStore, + currentWorkspaceAtom: currentWorkspaceAtom, + currentPageAtom: currentPageAtom, + contentLayoutAtom: contentLayoutAtom, + }) + ) + ); _rootImportsMap.set('swr', new Map(Object.entries(SWR))); }; diff --git a/apps/core/src/components/page-detail-editor.tsx b/apps/core/src/components/page-detail-editor.tsx index 0f1a3c2753..1557235723 100644 --- a/apps/core/src/components/page-detail-editor.tsx +++ b/apps/core/src/components/page-detail-editor.tsx @@ -1,6 +1,7 @@ import './page-detail-editor.css'; import { PageNotFoundError } from '@affine/env/constant'; +import type { CallbackMap, LayoutNode } from '@affine/sdk//entry'; import { rootBlockHubAtom } from '@affine/workspace/atom'; import type { EditorContainer } from '@blocksuite/editor'; import { assertExists } from '@blocksuite/global/utils'; @@ -13,8 +14,6 @@ import { rootStore, windowItemsAtom, } from '@toeverything/plugin-infra/atom'; -import type { CallbackMap } from '@toeverything/plugin-infra/entry'; -import type { LayoutNode } from '@toeverything/plugin-infra/type'; import clsx from 'clsx'; import { useAtomValue, useSetAtom } from 'jotai'; import type { CSSProperties, FC, ReactElement } from 'react'; diff --git a/apps/electron/forge.config.js b/apps/electron/forge.config.js index 3025e798e6..5a1007b8d1 100644 --- a/apps/electron/forge.config.js +++ b/apps/electron/forge.config.js @@ -137,6 +137,20 @@ module.exports = { force: true, } ); + + await rm(resolve(__dirname, './node_modules/@affine/sdk'), { + recursive: true, + force: true, + }); + + await cp( + resolve(__dirname, '../../packages/sdk'), + resolve(__dirname, './node_modules/@affine/sdk'), + { + recursive: true, + force: true, + } + ); }, generateAssets: async (_, platform, arch) => { if (process.env.SKIP_GENERATE_ASSETS) { diff --git a/apps/electron/package.json b/apps/electron/package.json index 3686dbe885..79d515e0fe 100644 --- a/apps/electron/package.json +++ b/apps/electron/package.json @@ -27,6 +27,7 @@ "@affine/env": "workspace:*", "@affine/maker-dmg": "workspace:*", "@affine/native": "workspace:*", + "@affine/sdk": "workspace:*", "@blocksuite/blocks": "0.0.0-20230802200139-381599c0-nightly", "@blocksuite/editor": "0.0.0-20230802200139-381599c0-nightly", "@blocksuite/lit": "0.0.0-20230802200139-381599c0-nightly", diff --git a/apps/electron/src/worker/plugin.ts b/apps/electron/src/worker/plugin.ts index 2744963308..3597091860 100644 --- a/apps/electron/src/worker/plugin.ts +++ b/apps/electron/src/worker/plugin.ts @@ -1,7 +1,7 @@ import { join, resolve } from 'node:path'; import { parentPort } from 'node:worker_threads'; -import type { ServerContext } from '@toeverything/plugin-infra/server'; +import type { ServerContext } from '@affine/sdk/server'; import { AsyncCall } from 'async-call-rpc'; import { MessageEventChannel } from '../shared/utils'; diff --git a/apps/electron/tsconfig.json b/apps/electron/tsconfig.json index fabecbe665..344f065001 100644 --- a/apps/electron/tsconfig.json +++ b/apps/electron/tsconfig.json @@ -25,6 +25,9 @@ { "path": "../../packages/infra" }, + { + "path": "../../packages/sdk" + }, { "path": "../../packages/env" }, diff --git a/package.json b/package.json index 23544a32dc..6206f85425 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", + "build:infra": "yarn nx run-many -t build -p plugin-infra 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", diff --git a/packages/plugin-infra/package.json b/packages/plugin-infra/package.json index 907b9acccc..529bfa98fc 100644 --- a/packages/plugin-infra/package.json +++ b/packages/plugin-infra/package.json @@ -36,6 +36,7 @@ } }, "dependencies": { + "@affine/sdk": "workspace:*", "@blocksuite/global": "0.0.0-20230802200139-381599c0-nightly", "@blocksuite/store": "0.0.0-20230802200139-381599c0-nightly", "jotai": "^2.2.2", diff --git a/packages/plugin-infra/src/atom.ts b/packages/plugin-infra/src/atom.ts index cc902d727e..2da6ed3b87 100644 --- a/packages/plugin-infra/src/atom.ts +++ b/packages/plugin-infra/src/atom.ts @@ -1,10 +1,9 @@ +import type { CallbackMap, ExpectedLayout } from '@affine/sdk/entry'; import { assertExists } from '@blocksuite/global/utils'; import type { Page, Workspace } from '@blocksuite/store'; import { atom, createStore } from 'jotai/vanilla'; import { getWorkspace, waitForWorkspace } from './__internal__/workspace.js'; -import type { CallbackMap } from './entry.js'; -import type { ExpectedLayout } from './type.js'; // global store export const rootStore = createStore(); diff --git a/packages/plugin-infra/src/entry.ts b/packages/plugin-infra/src/entry.ts deleted file mode 100644 index 337f7e5129..0000000000 --- a/packages/plugin-infra/src/entry.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { getCurrentBlockRange } from '@blocksuite/blocks'; -import type { EditorContainer } from '@blocksuite/editor'; -import type { Page } from '@blocksuite/store'; -import type { FC } from 'react'; - -export type Part = 'headerItem' | 'editor' | 'window' | 'setting' | 'formatBar'; - -export type CallbackMap = { - headerItem: (root: HTMLElement) => () => void; - window: (root: HTMLElement) => () => void; - editor: (root: HTMLElement, editor: EditorContainer) => () => void; - setting: (root: HTMLElement) => () => void; - formatBar: ( - root: HTMLElement, - page: Page, - getBlockRange: () => ReturnType - ) => () => void; -}; - -export interface PluginContext { - register: (part: T, callback: CallbackMap[T]) => void; - utils: { - PluginProvider: FC; - }; -} diff --git a/packages/plugin-infra/src/type.ts b/packages/plugin-infra/src/type.ts index 6896fe7672..1c0df9b993 100644 --- a/packages/plugin-infra/src/type.ts +++ b/packages/plugin-infra/src/type.ts @@ -1,3 +1,4 @@ +import type { ExpectedLayout } from '@affine/sdk/entry'; import type { WritableAtom } from 'jotai'; import { z } from 'zod'; @@ -29,26 +30,6 @@ export const packageJsonOutputSchema = z.object({ }), }); -export type LayoutDirection = 'horizontal' | 'vertical'; -export type LayoutNode = LayoutParentNode | string; -export type LayoutParentNode = { - direction: LayoutDirection; - splitPercentage: number; // 0 - 100 - first: LayoutNode; - second: LayoutNode; -}; - -export type ExpectedLayout = - | { - direction: LayoutDirection; - // the first element is always the editor - first: 'editor'; - second: LayoutNode; - // the percentage should be greater than 70 - splitPercentage: number; - } - | 'editor'; - type SetStateAction = Value | ((prev: Value) => Value); export type ContentLayoutAtom = WritableAtom< diff --git a/packages/plugin-infra/vite.config.ts b/packages/plugin-infra/vite.config.ts index 61241dc203..d2f110482a 100644 --- a/packages/plugin-infra/vite.config.ts +++ b/packages/plugin-infra/vite.config.ts @@ -11,7 +11,6 @@ export default defineConfig({ minify: false, lib: { entry: { - entry: resolve(root, 'src/entry.ts'), type: resolve(root, 'src/type.ts'), atom: resolve(root, 'src/atom.ts'), '__internal__/workspace': resolve( diff --git a/packages/sdk/package.json b/packages/sdk/package.json new file mode 100644 index 0000000000..ff91eec378 --- /dev/null +++ b/packages/sdk/package.json @@ -0,0 +1,35 @@ +{ + "name": "@affine/sdk", + "version": "0.0.1", + "type": "module", + "scripts": { + "build": "vite build", + "dev": "vite build --watch" + }, + "exports": { + "./entry": { + "types": "./dist/src/entry.d.ts", + "import": "./dist/entry.js", + "require": "./dist/entry.cjs" + }, + "./server": { + "types": "./dist/src/server.d.ts", + "import": "./dist/server.js", + "require": "./dist/server.cjs" + } + }, + "files": [ + "dist" + ], + "dependencies": { + "@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": { + "vite": "^4.4.7", + "vite-plugin-dts": "3.3.1" + } +} diff --git a/packages/sdk/project.json b/packages/sdk/project.json new file mode 100644 index 0000000000..009aa04101 --- /dev/null +++ b/packages/sdk/project.json @@ -0,0 +1,21 @@ +{ + "name": "sdk", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "library", + "sourceRoot": "packages/sdk/src", + "targets": { + "build": { + "executor": "@nx/vite:build", + "options": { + "outputPath": "packages/sdk/dist" + } + }, + "serve": { + "executor": "@nx/vite:build", + "options": { + "outputPath": "packages/sdk/dist", + "watch": true + } + } + } +} diff --git a/packages/sdk/src/entry.ts b/packages/sdk/src/entry.ts new file mode 100644 index 0000000000..34bb4e1151 --- /dev/null +++ b/packages/sdk/src/entry.ts @@ -0,0 +1,52 @@ +import type { getCurrentBlockRange } from '@blocksuite/blocks'; +import type { EditorContainer } from '@blocksuite/editor'; +import type { Page } from '@blocksuite/store'; +import type { Workspace } from '@blocksuite/store'; +import type { Atom, getDefaultStore, PrimitiveAtom } from 'jotai/vanilla'; +import type { FC } from 'react'; + +export type Part = 'headerItem' | 'editor' | 'window' | 'setting' | 'formatBar'; + +export type CallbackMap = { + headerItem: (root: HTMLElement) => () => void; + window: (root: HTMLElement) => () => void; + editor: (root: HTMLElement, editor: EditorContainer) => () => void; + setting: (root: HTMLElement) => () => void; + formatBar: ( + root: HTMLElement, + page: Page, + getBlockRange: () => ReturnType + ) => () => void; +}; + +export interface PluginContext { + register: (part: T, callback: CallbackMap[T]) => void; + utils: { + PluginProvider: FC; + }; +} + +export type LayoutDirection = 'horizontal' | 'vertical'; +export type LayoutNode = LayoutParentNode | string; +export type LayoutParentNode = { + direction: LayoutDirection; + splitPercentage: number; // 0 - 100 + first: LayoutNode; + second: LayoutNode; +}; + +export type ExpectedLayout = + | { + direction: LayoutDirection; + // the first element is always the editor + first: 'editor'; + second: LayoutNode; + // the percentage should be greater than 70 + splitPercentage: number; + } + | 'editor'; + +export declare const contentLayoutAtom: PrimitiveAtom; +export declare const currentPageAtom: Atom>; +export declare const currentWorkspaceAtom: Atom>; +export declare const rootStore: ReturnType; diff --git a/packages/plugin-infra/src/server.ts b/packages/sdk/src/server.ts similarity index 100% rename from packages/plugin-infra/src/server.ts rename to packages/sdk/src/server.ts diff --git a/packages/sdk/tsconfig.json b/packages/sdk/tsconfig.json new file mode 100644 index 0000000000..bb261ffb35 --- /dev/null +++ b/packages/sdk/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.json", + "include": ["./src"], + "compilerOptions": { + "composite": true, + "noEmit": false, + "moduleResolution": "Node16", + "outDir": "lib" + }, + "references": [ + { + "path": "./tsconfig.node.json" + } + ] +} diff --git a/packages/sdk/tsconfig.node.json b/packages/sdk/tsconfig.node.json new file mode 100644 index 0000000000..ff5308300e --- /dev/null +++ b/packages/sdk/tsconfig.node.json @@ -0,0 +1,12 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node", + "allowSyntheticDefaultImports": true, + "outDir": "lib", + "noEmit": false + }, + "include": ["vite.config.ts"] +} diff --git a/packages/sdk/vite.config.ts b/packages/sdk/vite.config.ts new file mode 100644 index 0000000000..d158eff203 --- /dev/null +++ b/packages/sdk/vite.config.ts @@ -0,0 +1,23 @@ +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: { + entry: resolve(root, 'src/entry.ts'), + server: resolve(root, 'src/server.ts'), + }, + }, + rollupOptions: { + external: [/^jotai/, /^@blocksuite/, 'zod'], + }, + }, + plugins: [dts()], +}); diff --git a/plugins/bookmark/package.json b/plugins/bookmark/package.json index f4963ed465..96a109ac31 100644 --- a/plugins/bookmark/package.json +++ b/plugins/bookmark/package.json @@ -19,8 +19,8 @@ }, "dependencies": { "@affine/component": "workspace:*", + "@affine/sdk": "workspace:*", "@blocksuite/icons": "^2.1.29", - "@toeverything/plugin-infra": "workspace:*", "foxact": "^0.2.17", "link-preview-js": "^3.0.4" }, diff --git a/plugins/bookmark/src/index.ts b/plugins/bookmark/src/index.ts index deae092512..c143005606 100644 --- a/plugins/bookmark/src/index.ts +++ b/plugins/bookmark/src/index.ts @@ -1,4 +1,4 @@ -import type { PluginContext } from '@toeverything/plugin-infra/entry'; +import type { PluginContext } from '@affine/sdk/entry'; import { createElement } from 'react'; import { createRoot } from 'react-dom/client'; diff --git a/plugins/bookmark/src/server.ts b/plugins/bookmark/src/server.ts index c6870fa0af..f0bc9a360c 100644 --- a/plugins/bookmark/src/server.ts +++ b/plugins/bookmark/src/server.ts @@ -1,4 +1,4 @@ -import type { ServerContext } from '@toeverything/plugin-infra/server'; +import type { ServerContext } from '@affine/sdk/server'; import { getLinkPreview } from 'link-preview-js'; type MetaData = { diff --git a/plugins/bookmark/tsconfig.json b/plugins/bookmark/tsconfig.json index f2db0bc490..88ac2ab9f9 100644 --- a/plugins/bookmark/tsconfig.json +++ b/plugins/bookmark/tsconfig.json @@ -8,7 +8,7 @@ }, "references": [ { - "path": "../../packages/plugin-infra" + "path": "../../packages/sdk" }, { "path": "../../packages/component" diff --git a/plugins/copilot/package.json b/plugins/copilot/package.json index c0776f08ca..a40f79e3f6 100644 --- a/plugins/copilot/package.json +++ b/plugins/copilot/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@affine/component": "workspace:*", - "@toeverything/plugin-infra": "workspace:*", + "@affine/sdk": "workspace:*", "idb": "^7.1.1", "langchain": "^0.0.118", "marked": "^5.1.1", diff --git a/plugins/copilot/src/index.ts b/plugins/copilot/src/index.ts index 2b9a29366f..8e7fc63761 100644 --- a/plugins/copilot/src/index.ts +++ b/plugins/copilot/src/index.ts @@ -1,4 +1,4 @@ -import type { PluginContext } from '@toeverything/plugin-infra/entry'; +import type { PluginContext } from '@affine/sdk/entry'; import { createElement } from 'react'; import { createRoot } from 'react-dom/client'; diff --git a/plugins/copilot/tsconfig.json b/plugins/copilot/tsconfig.json index 85a28c467d..6cdf98dc55 100644 --- a/plugins/copilot/tsconfig.json +++ b/plugins/copilot/tsconfig.json @@ -10,7 +10,7 @@ "path": "../../packages/component" }, { - "path": "../../packages/plugin-infra" + "path": "../../packages/sdk" }, { "path": "../../packages/env" diff --git a/plugins/hello-world/package.json b/plugins/hello-world/package.json index 11e359350c..7ab9d2f484 100644 --- a/plugins/hello-world/package.json +++ b/plugins/hello-world/package.json @@ -16,6 +16,7 @@ }, "dependencies": { "@affine/component": "workspace:*", + "@affine/sdk": "workspace:*", "@blocksuite/icons": "^2.1.29", "@toeverything/plugin-infra": "workspace:*" }, diff --git a/plugins/hello-world/src/index.ts b/plugins/hello-world/src/index.ts index 925dadbb2d..2e535d0101 100644 --- a/plugins/hello-world/src/index.ts +++ b/plugins/hello-world/src/index.ts @@ -1,8 +1,5 @@ -import { - currentWorkspaceIdAtom, - rootStore, -} from '@toeverything/plugin-infra/atom'; -import type { PluginContext } from '@toeverything/plugin-infra/entry'; +import type { PluginContext } from '@affine/sdk/entry'; +import { currentWorkspaceAtom, rootStore } from '@affine/sdk/entry'; import { createElement } from 'react'; import { lazy } from 'react'; import { createRoot } from 'react-dom/client'; @@ -14,7 +11,7 @@ const HeaderItem = lazy(() => export const entry = (context: PluginContext) => { console.log('register'); console.log('hello, world!'); - console.log(rootStore.get(currentWorkspaceIdAtom)); + console.log(rootStore.get(currentWorkspaceAtom)); context.register('headerItem', div => { const root = createRoot(div); root.render(createElement(HeaderItem)); diff --git a/plugins/hello-world/tsconfig.json b/plugins/hello-world/tsconfig.json index f2db0bc490..88ac2ab9f9 100644 --- a/plugins/hello-world/tsconfig.json +++ b/plugins/hello-world/tsconfig.json @@ -8,7 +8,7 @@ }, "references": [ { - "path": "../../packages/plugin-infra" + "path": "../../packages/sdk" }, { "path": "../../packages/component" diff --git a/plugins/image-preview/package.json b/plugins/image-preview/package.json index 1380f62b59..64688c6873 100644 --- a/plugins/image-preview/package.json +++ b/plugins/image-preview/package.json @@ -15,8 +15,8 @@ }, "dependencies": { "@affine/component": "workspace:*", + "@affine/sdk": "workspace:*", "@blocksuite/icons": "^2.1.29", - "@toeverything/plugin-infra": "workspace:*", "@toeverything/theme": "^0.7.9", "clsx": "^2.0.0", "foxact": "^0.2.17", diff --git a/plugins/image-preview/src/index.ts b/plugins/image-preview/src/index.ts index 5a95f4b96a..d366fbb7d3 100644 --- a/plugins/image-preview/src/index.ts +++ b/plugins/image-preview/src/index.ts @@ -1,4 +1,4 @@ -import type { PluginContext } from '@toeverything/plugin-infra/entry'; +import type { PluginContext } from '@affine/sdk/entry'; import { createElement } from 'react'; import { createRoot } from 'react-dom/client'; diff --git a/plugins/image-preview/tsconfig.json b/plugins/image-preview/tsconfig.json index f2db0bc490..88ac2ab9f9 100644 --- a/plugins/image-preview/tsconfig.json +++ b/plugins/image-preview/tsconfig.json @@ -8,7 +8,7 @@ }, "references": [ { - "path": "../../packages/plugin-infra" + "path": "../../packages/sdk" }, { "path": "../../packages/component" diff --git a/scripts/publish.sh b/scripts/publish.sh index 19313fd3bd..56a4a02c08 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -4,6 +4,7 @@ packages=( "y-indexeddb" "infra" "plugin-infra" + "sdk" ) for package in "${packages[@]}"; do diff --git a/tsconfig.json b/tsconfig.json index d001e001c4..1b08cdafc8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -77,6 +77,7 @@ "@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/*"], "@affine/storage": ["./packages/storage/index.d.ts"], @@ -104,6 +105,9 @@ { "path": "./packages/infra" }, + { + "path": "./packages/plugin-infra" + }, { "path": "./packages/graphql" }, @@ -112,7 +116,7 @@ }, // Plugins { - "path": "./packages/plugin-infra" + "path": "./packages/sdk" }, { "path": "./plugins/bookmark" @@ -123,6 +127,9 @@ { "path": "./plugins/hello-world" }, + { + "path": "./plugins/image-preview" + }, // Packages { "path": "./packages/cli" diff --git a/yarn.lock b/yarn.lock index 1b4ae05bf3..edbcaef966 100644 --- a/yarn.lock +++ b/yarn.lock @@ -95,8 +95,8 @@ __metadata: dependencies: "@affine/component": "workspace:*" "@affine/plugin-cli": "workspace:*" + "@affine/sdk": "workspace:*" "@blocksuite/icons": ^2.1.29 - "@toeverything/plugin-infra": "workspace:*" foxact: ^0.2.17 link-preview-js: ^3.0.4 languageName: unknown @@ -186,7 +186,7 @@ __metadata: dependencies: "@affine/component": "workspace:*" "@affine/plugin-cli": "workspace:*" - "@toeverything/plugin-infra": "workspace:*" + "@affine/sdk": "workspace:*" "@types/marked": ^5.0.1 idb: ^7.1.1 jotai: ^2.2.2 @@ -321,6 +321,7 @@ __metadata: "@affine/env": "workspace:*" "@affine/maker-dmg": "workspace:*" "@affine/native": "workspace:*" + "@affine/sdk": "workspace:*" "@blocksuite/blocks": 0.0.0-20230802200139-381599c0-nightly "@blocksuite/editor": 0.0.0-20230802200139-381599c0-nightly "@blocksuite/lit": 0.0.0-20230802200139-381599c0-nightly @@ -401,6 +402,7 @@ __metadata: dependencies: "@affine/component": "workspace:*" "@affine/plugin-cli": "workspace:*" + "@affine/sdk": "workspace:*" "@blocksuite/icons": ^2.1.29 "@toeverything/plugin-infra": "workspace:*" languageName: unknown @@ -426,8 +428,8 @@ __metadata: dependencies: "@affine/component": "workspace:*" "@affine/plugin-cli": "workspace:*" + "@affine/sdk": "workspace:*" "@blocksuite/icons": ^2.1.29 - "@toeverything/plugin-infra": "workspace:*" "@toeverything/theme": ^0.7.9 clsx: ^2.0.0 foxact: ^0.2.17 @@ -565,6 +567,20 @@ __metadata: languageName: unknown linkType: soft +"@affine/sdk@workspace:*, @affine/sdk@workspace:packages/sdk": + version: 0.0.0-use.local + resolution: "@affine/sdk@workspace:packages/sdk" + dependencies: + "@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 + vite: ^4.4.7 + vite-plugin-dts: 3.3.1 + zod: ^3.21.4 + languageName: unknown + linkType: soft + "@affine/server@workspace:apps/server": version: 0.0.0-use.local resolution: "@affine/server@workspace:apps/server" @@ -11396,6 +11412,7 @@ __metadata: 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 "@blocksuite/editor": 0.0.0-20230802200139-381599c0-nightly "@blocksuite/global": 0.0.0-20230802200139-381599c0-nightly