feat: isolated plugin system (#2742)

This commit is contained in:
Himself65
2023-06-09 16:43:46 +08:00
committed by GitHub
parent af6f431c15
commit f2ac2e5b84
51 changed files with 489 additions and 209 deletions

View File

@@ -35,6 +35,7 @@
"@radix-ui/react-radio-group": "^1.1.3",
"@radix-ui/react-toast": "^1.1.4",
"@toeverything/hooks": "workspace:*",
"@toeverything/plugin-infra": "workspace:*",
"@toeverything/theme": "^0.6.1",
"@vanilla-extract/dynamic": "^2.0.3",
"clsx": "^1.2.1",

View File

@@ -0,0 +1,23 @@
import { ProviderComposer } from '@affine/component/provider-composer';
import { ThemeProvider } from '@affine/component/theme-provider';
import { rootStore } from '@toeverything/plugin-infra/manager';
import { Provider } from 'jotai';
import type { PropsWithChildren } from 'react';
import { useMemo } from 'react';
export function AffineContext(props: PropsWithChildren) {
return (
<ProviderComposer
contexts={useMemo(
() =>
[
<Provider key="JotaiProvider" store={rootStore} />,
<ThemeProvider key="ThemeProvider" />,
].filter(Boolean),
[]
)}
>
{props.children}
</ProviderComposer>
);
}

View File

@@ -20,10 +20,10 @@
{
"path": "../hooks"
},
{ "path": "../workspace" },
{
"path": "../../apps/electron"
"path": "../plugin-infra"
},
{ "path": "../workspace" },
{ "path": "../../tests/fixtures" }
]
}

View File

@@ -1,18 +0,0 @@
// to prevent the `@affine/components` contains circular references with `@affine/workspace`
// the include files should be excluded in `./tsconfig.json`
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"noEmit": false,
"outDir": "lib"
},
"include": [
"./src/components/page-list/filter/shared-types.tsx",
"./src/components/page-list/filter/logical/custom-type.ts",
"./src/components/page-list/filter/logical/matcher.ts",
"./src/components/page-list/filter/logical/typesystem.ts"
],
"references": [{ "path": "../env" }],
"exclude": ["lib"]
}