feat(plugin-infra): add package.json schema (#3456)

This commit is contained in:
Alex Yang
2023-07-28 22:07:25 -07:00
committed by GitHub
parent 2d95de06d6
commit f79733e5df
13 changed files with 65 additions and 35 deletions

View File

@@ -6,7 +6,7 @@ import { useEffect } from 'react';
import {
getActiveBlockSuiteWorkspaceAtom,
workspacePassiveEffectWeakMap,
} from './workspace';
} from './workspace.js';
export function useStaticBlockSuiteWorkspace(id: string): Workspace {
return useAtomValue(getActiveBlockSuiteWorkspaceAtom(id));

View File

@@ -9,11 +9,11 @@ import { expect, test, vi } from 'vitest';
import {
usePassiveWorkspaceEffect,
useStaticBlockSuiteWorkspace,
} from '../__internal__/react';
} from '../__internal__/react.js';
import {
getActiveBlockSuiteWorkspaceAtom,
INTERNAL_BLOCKSUITE_HASH_MAP,
} from '../__internal__/workspace';
} from '../__internal__/workspace.js';
test('useStaticBlockSuiteWorkspace', async () => {
const sync = vi.fn();

View File

@@ -2,9 +2,9 @@ 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';
import type { CallbackMap } from './entry';
import type { ExpectedLayout } from './type';
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();

View File

@@ -1,4 +1,31 @@
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(),
}),
}),
});
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()),
}),
});
export type LayoutDirection = 'horizontal' | 'vertical';
export type LayoutNode = LayoutParentNode | string;