feat: isolated plugin system (#2742)

(cherry picked from commit f2ac2e5b84)
This commit is contained in:
Himself65
2023-06-09 16:43:46 +08:00
committed by Alex Yang
parent a0ee00a4b2
commit af205cde7c
51 changed files with 489 additions and 209 deletions
+1
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",
@@ -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>
);
}
+2 -2
View File
@@ -20,10 +20,10 @@
{
"path": "../hooks"
},
{ "path": "../workspace" },
{
"path": "../../apps/electron"
"path": "../plugin-infra"
},
{ "path": "../workspace" },
{ "path": "../../tests/fixtures" }
]
}
@@ -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"]
}