mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-22 09:13:18 +03:00
chore: prohibit import package itself (#2612)
Co-authored-by: Whitewater <me@waterwater.moe>
This commit is contained in:
parent
06abb702f5
commit
248cd9a8ab
51
.eslintrc.js
51
.eslintrc.js
@ -1,3 +1,43 @@
|
||||
const createPattern = packageName => [
|
||||
{
|
||||
group: ['**/dist', '**/dist/**'],
|
||||
message: 'Do not import from dist',
|
||||
allowTypeImports: false,
|
||||
},
|
||||
{
|
||||
group: ['**/src', '**/src/**'],
|
||||
message: 'Do not import from src',
|
||||
allowTypeImports: false,
|
||||
},
|
||||
{
|
||||
group: [`@affine/${packageName}`],
|
||||
message: 'Do not import package itself',
|
||||
allowTypeImports: false,
|
||||
},
|
||||
{
|
||||
group: [`@toeverything/${packageName}`],
|
||||
message: 'Do not import package itself',
|
||||
allowTypeImports: false,
|
||||
},
|
||||
];
|
||||
|
||||
const allPackages = [
|
||||
'cli',
|
||||
'component',
|
||||
'debug',
|
||||
'env',
|
||||
'graphql',
|
||||
'hooks',
|
||||
'i18n',
|
||||
'jotai',
|
||||
'native',
|
||||
'plugin-infra',
|
||||
'templates',
|
||||
'theme',
|
||||
'workspace',
|
||||
'y-indexeddb',
|
||||
];
|
||||
|
||||
/**
|
||||
* @type {import('eslint').Linter.Config}
|
||||
*/
|
||||
@ -96,6 +136,17 @@ const config = {
|
||||
'@typescript-eslint/no-var-requires': 0,
|
||||
},
|
||||
},
|
||||
...allPackages.map(pkg => ({
|
||||
files: [`packages/${pkg}/src/**/*.ts`, `packages/${pkg}/src/**/*.tsx`],
|
||||
rules: {
|
||||
'@typescript-eslint/no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
patterns: createPattern(pkg),
|
||||
},
|
||||
],
|
||||
},
|
||||
})),
|
||||
],
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { IconButton } from '@affine/component';
|
||||
import {
|
||||
DeleteTemporarilyIcon,
|
||||
SettingsIcon,
|
||||
@ -8,6 +7,7 @@ import type { Meta, StoryFn } from '@storybook/react';
|
||||
import { useAtom } from 'jotai';
|
||||
import { type PropsWithChildren, useState } from 'react';
|
||||
|
||||
import { IconButton } from '../..';
|
||||
import { AppSidebar, AppSidebarFallback, appSidebarOpenAtom } from '.';
|
||||
import { AddPageButton } from './add-page-button';
|
||||
import { CategoryDivider } from './category-divider';
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { IconButton } from '@affine/component';
|
||||
import { getEnvironment } from '@affine/env/config';
|
||||
import {
|
||||
ArrowLeftSmallIcon,
|
||||
@ -7,6 +6,7 @@ import {
|
||||
} from '@blocksuite/icons';
|
||||
import { useAtom } from 'jotai';
|
||||
|
||||
import { IconButton } from '../../..';
|
||||
import type { History } from '..';
|
||||
import { navHeaderStyle, sidebarButtonStyle } from '../index.css';
|
||||
import { appSidebarOpenAtom } from '../index.jotai';
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { MenuItem, MuiClickAwayListener, PureMenu } from '@affine/component';
|
||||
import type { EditorPlugin } from '@affine/component/block-suite-editor';
|
||||
import type { SerializedBlock } from '@blocksuite/blocks';
|
||||
import {
|
||||
getCurrentBlockRange,
|
||||
@ -10,6 +8,9 @@ import type { Page } from '@blocksuite/store';
|
||||
import { assertExists } from '@blocksuite/store';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
|
||||
import { MenuItem, MuiClickAwayListener, PureMenu } from '../../..';
|
||||
import type { EditorPlugin } from '..';
|
||||
|
||||
type ShortcutMap = {
|
||||
[key: string]: (e: KeyboardEvent, page: Page) => void;
|
||||
};
|
||||
|
@ -1,11 +1,6 @@
|
||||
import {
|
||||
FlexWrapper,
|
||||
Modal,
|
||||
ModalCloseButton,
|
||||
ModalWrapper,
|
||||
} from '@affine/component';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
|
||||
import { FlexWrapper, Modal, ModalCloseButton, ModalWrapper } from '../..';
|
||||
import {
|
||||
DiscordIcon,
|
||||
DocIcon,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { absoluteCenter, displayFlex, styled } from '@affine/component';
|
||||
import { absoluteCenter, displayFlex, styled } from '../..';
|
||||
|
||||
export const StyledBigLink = styled('a')(() => {
|
||||
return {
|
||||
|
@ -1,10 +1,3 @@
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableRow,
|
||||
} from '@affine/component';
|
||||
import { DEFAULT_SORT_KEY } from '@affine/env/constant';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { ArrowDownBigIcon, ArrowUpBigIcon } from '@blocksuite/icons';
|
||||
@ -12,6 +5,7 @@ import { useMediaQuery, useTheme } from '@mui/material';
|
||||
import type React from 'react';
|
||||
import { type CSSProperties } from 'react';
|
||||
|
||||
import { Table, TableBody, TableCell, TableHead, TableRow } from '../..';
|
||||
import { AllPagesBody } from './all-pages-body';
|
||||
import { NewPageButton } from './components/new-page-buttton';
|
||||
import { TitleCell } from './components/title-cell';
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { styled, TableBody, TableCell } from '@affine/component';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { useDraggable } from '@dnd-kit/core';
|
||||
import type { ReactNode } from 'react';
|
||||
import { Fragment } from 'react';
|
||||
|
||||
import { styled, TableBody, TableCell } from '../../..';
|
||||
import { FavoriteTag } from './components/favorite-tag';
|
||||
import { TitleCell } from './components/title-cell';
|
||||
import { OperationCell } from './operation-cell';
|
||||
|
@ -1,9 +1,10 @@
|
||||
import type { IconButtonProps } from '@affine/component';
|
||||
import { IconButton, Tooltip } from '@affine/component';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { FavoritedIcon, FavoriteIcon } from '@blocksuite/icons';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
import type { IconButtonProps } from '../../..';
|
||||
import { IconButton, Tooltip } from '../../..';
|
||||
|
||||
export const FavoriteTag = forwardRef<
|
||||
HTMLButtonElement,
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { TableCellProps } from '@affine/component';
|
||||
import { Content, TableCell } from '@affine/component';
|
||||
import React, { useCallback } from 'react';
|
||||
|
||||
import type { TableCellProps } from '../../..';
|
||||
import { Content, TableCell } from '../../..';
|
||||
import {
|
||||
StyledTitleContentWrapper,
|
||||
StyledTitleLink,
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Menu } from '@affine/component';
|
||||
|
||||
import { Menu } from '../../..';
|
||||
import { Condition } from './condition';
|
||||
import type { Filter } from './vars';
|
||||
import { CreateFilterMenu } from './vars';
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
|
||||
import {
|
||||
Content,
|
||||
Table,
|
||||
@ -5,9 +7,7 @@ import {
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableRow,
|
||||
} from '@affine/component';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
|
||||
} from '../../..';
|
||||
import { AllPagesBody } from './all-pages-body';
|
||||
import { NewPageButton } from './components/new-page-buttton';
|
||||
import {
|
||||
|
@ -1,11 +1,3 @@
|
||||
import {
|
||||
Confirm,
|
||||
FlexWrapper,
|
||||
IconButton,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Tooltip,
|
||||
} from '@affine/component';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import {
|
||||
DeletePermanentlyIcon,
|
||||
@ -18,6 +10,14 @@ import {
|
||||
import type React from 'react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import {
|
||||
Confirm,
|
||||
FlexWrapper,
|
||||
IconButton,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Tooltip,
|
||||
} from '../../..';
|
||||
import { DisablePublicSharing, MoveToTrash } from './operation-menu-items';
|
||||
|
||||
export type OperationCellProps = {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { MenuItem, toast } from '@affine/component';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { CopyIcon } from '@blocksuite/icons';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { MenuItem, toast } from '../../..';
|
||||
import type { CommonMenuItemProps } from './types';
|
||||
|
||||
export const CopyLink = ({ onItemClick, onSelect }: CommonMenuItemProps) => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { MenuItem, styled } from '@affine/component';
|
||||
import { PublicLinkDisableModal } from '@affine/component/share-menu';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { ShareIcon } from '@blocksuite/icons';
|
||||
|
||||
import { MenuItem, styled } from '../../../';
|
||||
import { PublicLinkDisableModal } from '../../share-menu';
|
||||
import type { CommonMenuItemProps } from './types';
|
||||
|
||||
const StyledMenuItem = styled(MenuItem)(({ theme }) => {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { Menu, MenuItem } from '@affine/component';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import type { PageBlockModel } from '@blocksuite/blocks';
|
||||
import { ContentParser } from '@blocksuite/blocks/content-parser';
|
||||
@ -12,6 +11,7 @@ import {
|
||||
} from '@blocksuite/icons';
|
||||
import { useRef } from 'react';
|
||||
|
||||
import { Menu, MenuItem } from '../../..';
|
||||
import type { CommonMenuItemProps } from './types';
|
||||
|
||||
export const Export = ({
|
||||
|
@ -1,8 +1,8 @@
|
||||
import type { ConfirmProps } from '@affine/component';
|
||||
import { Confirm, MenuItem } from '@affine/component';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { DeleteTemporarilyIcon } from '@blocksuite/icons';
|
||||
|
||||
import type { ConfirmProps } from '../../..';
|
||||
import { Confirm, MenuItem } from '../../..';
|
||||
import type { CommonMenuItemProps } from './types';
|
||||
|
||||
export const MoveToTrash = ({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Content, displayFlex, styled } from '@affine/component';
|
||||
import { TableRow } from '@affine/component';
|
||||
import { TableRow } from '../..';
|
||||
import { Content, displayFlex, styled } from '../../';
|
||||
|
||||
export const StyledTableContainer = styled('div')(({ theme }) => {
|
||||
return {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Button, Input, Modal, ModalWrapper } from '@affine/component';
|
||||
import { uuidv4 } from '@blocksuite/store';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { Button, Input, Modal, ModalWrapper } from '../../..';
|
||||
import { FilterList } from '../filter';
|
||||
import type { Filter } from '../filter/vars';
|
||||
import type { View } from '../use-all-page-setting';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Button, MenuItem } from '@affine/component';
|
||||
import { FilteredIcon } from '@blocksuite/icons';
|
||||
|
||||
import { Button, MenuItem } from '../../..';
|
||||
import Menu from '../../../ui/menu/menu';
|
||||
import { CreateFilterMenu } from '../filter/vars';
|
||||
import type { useAllPageSetting } from '../use-all-page-setting';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { styled, TextButton } from '@affine/component';
|
||||
import { styled, TextButton } from '../../..';
|
||||
|
||||
export const StyledModalWrapper = styled('div')(() => {
|
||||
return {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { BlockCard } from '@affine/component/card/block-card';
|
||||
import { WorkspaceFlavour } from '@affine/workspace/type';
|
||||
import { EdgelessIcon, PageIcon } from '@blocksuite/icons';
|
||||
import { Workspace } from '@blocksuite/store';
|
||||
|
||||
import { BlockCard } from '../components/card/block-card';
|
||||
import { WorkspaceCard } from '../components/card/workspace-card';
|
||||
import { toast } from '../ui/toast';
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { Button } from '@affine/component';
|
||||
import type { StoryFn } from '@storybook/react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import type { ContactModalProps } from '../components/contact-modal';
|
||||
import { ContactModal } from '../components/contact-modal';
|
||||
import { Button } from '../ui/button';
|
||||
|
||||
export default {
|
||||
title: 'AFFiNE/ContactModal',
|
||||
|
@ -1,9 +1,10 @@
|
||||
/**
|
||||
* @vitest-environment happy-dom
|
||||
*/
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import { describe, expect, test, vi } from 'vitest';
|
||||
|
||||
import { DebugLogger } from '..';
|
||||
|
||||
describe('debug', () => {
|
||||
test('disabled', () => {
|
||||
const logger = new DebugLogger('test');
|
||||
|
@ -9,14 +9,14 @@ import type { Page } from '@blocksuite/store';
|
||||
import { assertExists } from '@blocksuite/store';
|
||||
import { Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { useBlockSuitePagePreview } from '@toeverything/hooks/use-block-suite-page-preview';
|
||||
import { useBlockSuiteWorkspacePageIsPublic } from '@toeverything/hooks/use-block-suite-workspace-page-is-public';
|
||||
import { useBlockSuiteWorkspacePageTitle } from '@toeverything/hooks/use-block-suite-workspace-page-title';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { describe, expect, test, vitest } from 'vitest';
|
||||
import { beforeEach } from 'vitest';
|
||||
|
||||
import { useBlockSuitePagePreview } from '../use-block-suite-page-preview';
|
||||
import { useBlockSuiteWorkspaceName } from '../use-block-suite-workspace-name';
|
||||
import { useBlockSuiteWorkspacePageIsPublic } from '../use-block-suite-workspace-page-is-public';
|
||||
import { useBlockSuiteWorkspacePageTitle } from '../use-block-suite-workspace-page-title';
|
||||
|
||||
let blockSuiteWorkspace: BlockSuiteWorkspace;
|
||||
|
||||
|
@ -7,10 +7,11 @@ import { initPage } from '@affine/env/blocksuite';
|
||||
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||
import { Workspace } from '@blocksuite/store';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta';
|
||||
import { useBlockSuiteWorkspaceHelper } from '@toeverything/hooks/use-block-suite-workspace-helper';
|
||||
import { beforeEach, describe, expect, test } from 'vitest';
|
||||
|
||||
import { useBlockSuitePageMeta } from '../use-block-suite-page-meta';
|
||||
import { useBlockSuiteWorkspaceHelper } from '../use-block-suite-workspace-helper';
|
||||
|
||||
let blockSuiteWorkspace: Workspace;
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -6,10 +6,6 @@ import 'fake-indexeddb/auto';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
|
||||
import { MessageCode } from '@affine/env/constant';
|
||||
import { createStatusApis } from '@affine/workspace/affine/api/status';
|
||||
import { KeckProvider } from '@affine/workspace/affine/keck';
|
||||
import { WorkspaceFlavour } from '@affine/workspace/type';
|
||||
import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils';
|
||||
import user1 from '@affine-test/fixtures/built-in-user1.json';
|
||||
import user2 from '@affine-test/fixtures/built-in-user2.json';
|
||||
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||
@ -22,6 +18,8 @@ import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import { WebSocket } from 'ws';
|
||||
import { applyUpdate } from 'yjs';
|
||||
|
||||
import { WorkspaceFlavour } from '../../type';
|
||||
import { createEmptyBlockSuiteWorkspace } from '../../utils';
|
||||
import {
|
||||
createUserApis,
|
||||
createWorkspaceApis,
|
||||
@ -29,6 +27,8 @@ import {
|
||||
RequestError,
|
||||
usageResponseSchema,
|
||||
} from '../api';
|
||||
import { createStatusApis } from '../api/status';
|
||||
import { KeckProvider } from '../keck';
|
||||
import {
|
||||
createAffineAuth,
|
||||
getLoginStorage,
|
||||
|
@ -1,14 +1,15 @@
|
||||
/**
|
||||
* @vitest-environment happy-dom
|
||||
*/
|
||||
import type { AccessTokenMessage } from '@affine/workspace/affine/login';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import type { AccessTokenMessage } from '../login';
|
||||
import {
|
||||
getLoginStorage,
|
||||
isExpired,
|
||||
setLoginStorage,
|
||||
STORAGE_KEY,
|
||||
} from '@affine/workspace/affine/login';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
} from '../login';
|
||||
|
||||
describe('storage', () => {
|
||||
test('should work', () => {
|
||||
|
@ -3,16 +3,6 @@
|
||||
*/
|
||||
import 'fake-indexeddb/auto';
|
||||
|
||||
import type { Workspace } from '@affine/workspace/affine/api';
|
||||
import {
|
||||
createWorkspaceApis,
|
||||
PermissionType,
|
||||
} from '@affine/workspace/affine/api';
|
||||
import { KeckProvider } from '@affine/workspace/affine/keck';
|
||||
import type { LoginResponse } from '@affine/workspace/affine/login';
|
||||
import { loginResponseSchema } from '@affine/workspace/affine/login';
|
||||
import { WorkspaceFlavour } from '@affine/workspace/type';
|
||||
import { createEmptyBlockSuiteWorkspace } from '@affine/workspace/utils';
|
||||
import user1 from '@affine-test/fixtures/built-in-user1.json';
|
||||
import user2 from '@affine-test/fixtures/built-in-user2.json';
|
||||
import type { ParagraphBlockModel } from '@blocksuite/blocks/models';
|
||||
@ -21,6 +11,14 @@ import { uuidv4, Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import { WebSocket } from 'ws';
|
||||
|
||||
import type { LoginResponse } from '../../affine/login';
|
||||
import { loginResponseSchema } from '../../affine/login';
|
||||
import { WorkspaceFlavour } from '../../type';
|
||||
import { createEmptyBlockSuiteWorkspace } from '../../utils';
|
||||
import type { Workspace } from '../api';
|
||||
import { createWorkspaceApis, PermissionType } from '../api';
|
||||
import { KeckProvider } from '../keck';
|
||||
|
||||
declare module '@blocksuite/store' {
|
||||
interface PageMeta {
|
||||
foo: string;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { AccessTokenMessage } from '@affine/workspace/affine/login';
|
||||
import { atomWithStorage } from 'jotai/utils';
|
||||
|
||||
import type { AccessTokenMessage } from '../affine/login';
|
||||
|
||||
export const currentAffineUserAtom = atomWithStorage<AccessTokenMessage | null>(
|
||||
'affine-user-atom',
|
||||
null
|
||||
|
@ -1,15 +1,12 @@
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import {
|
||||
getLoginStorage,
|
||||
isExpired,
|
||||
parseIdToken,
|
||||
} from '@affine/workspace/affine/login';
|
||||
import { WorkspaceFlavour } from '@affine/workspace/type';
|
||||
import { cleanupWorkspace } from '@affine/workspace/utils';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import * as url from 'lib0/url';
|
||||
import * as websocket from 'lib0/websocket';
|
||||
|
||||
import { getLoginStorage, isExpired, parseIdToken } from '../affine/login';
|
||||
import { WorkspaceFlavour } from '../type';
|
||||
import { cleanupWorkspace } from '../utils';
|
||||
|
||||
const RECONNECT_INTERVAL_TIME = 500;
|
||||
const MAX_RECONNECT_TIMES = 50;
|
||||
|
||||
|
@ -1,18 +1,16 @@
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import { websocketPrefixUrl } from '@affine/env/api';
|
||||
import {
|
||||
workspaceDetailSchema,
|
||||
workspaceSchema,
|
||||
} from '@affine/workspace/affine/api';
|
||||
import { WebsocketClient } from '@affine/workspace/affine/channel';
|
||||
import { storageChangeSlot } from '@affine/workspace/affine/login';
|
||||
import { rootStore, rootWorkspacesMetadataAtom } from '@affine/workspace/atom';
|
||||
import type { WorkspaceCRUD } from '@affine/workspace/type';
|
||||
import type { WorkspaceFlavour } from '@affine/workspace/type';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import type { Disposable } from '@blocksuite/store';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { workspaceDetailSchema, workspaceSchema } from '../affine/api';
|
||||
import { WebsocketClient } from '../affine/channel';
|
||||
import { storageChangeSlot } from '../affine/login';
|
||||
import { rootStore, rootWorkspacesMetadataAtom } from '../atom';
|
||||
import type { WorkspaceCRUD } from '../type';
|
||||
import type { WorkspaceFlavour } from '../type';
|
||||
|
||||
const logger = new DebugLogger('affine-sync');
|
||||
|
||||
const channelMessageSchema = z.object({
|
||||
|
@ -1,9 +1,10 @@
|
||||
import type { createWorkspaceApis } from '@affine/workspace/affine/api';
|
||||
import type { BlobStorage } from '@blocksuite/store';
|
||||
import { createIndexeddbStorage } from '@blocksuite/store';
|
||||
import { openDB } from 'idb';
|
||||
import type { DBSchema } from 'idb/build/entry';
|
||||
|
||||
import type { createWorkspaceApis } from '../affine/api';
|
||||
|
||||
type UploadingBlob = {
|
||||
key: string;
|
||||
arrayBuffer: ArrayBuffer;
|
||||
|
@ -3,12 +3,12 @@
|
||||
*/
|
||||
import 'fake-indexeddb/auto';
|
||||
|
||||
import type { LocalWorkspace, WorkspaceCRUD } from '@affine/workspace/type';
|
||||
import { WorkspaceFlavour } from '@affine/workspace/type';
|
||||
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||
import { Workspace } from '@blocksuite/store';
|
||||
import { afterEach, assertType, describe, expect, test } from 'vitest';
|
||||
|
||||
import type { LocalWorkspace, WorkspaceCRUD } from '../../type';
|
||||
import { WorkspaceFlavour } from '../../type';
|
||||
import { CRUD } from '../crud';
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import type { SQLiteProvider } from '@affine/workspace/type';
|
||||
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||
import type { Y as YType } from '@blocksuite/store';
|
||||
import { uuidv4, Workspace } from '@blocksuite/store';
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
|
||||
import type { SQLiteProvider } from '../../type';
|
||||
import { createSQLiteProvider } from '../index';
|
||||
|
||||
const Y = Workspace.Y;
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { CallbackSet } from '@affine/workspace/utils';
|
||||
import { Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
|
||||
import { assertExists } from '@blocksuite/store';
|
||||
import type { Awareness } from 'y-protocols/awareness';
|
||||
@ -8,6 +7,7 @@ import {
|
||||
} from 'y-protocols/awareness';
|
||||
|
||||
import type { BroadCastChannelProvider } from '../../type';
|
||||
import { CallbackSet } from '../../utils';
|
||||
import { localProviderLogger } from '../logger';
|
||||
import type {
|
||||
AwarenessChanges,
|
||||
|
@ -1,13 +1,14 @@
|
||||
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
||||
/// <reference path='../../../apps/electron/layers/preload/preload.d.ts' />
|
||||
import type { View } from '@affine/component/page-list';
|
||||
import type { Workspace as RemoteWorkspace } from '@affine/workspace/affine/api';
|
||||
import type { EditorContainer } from '@blocksuite/editor';
|
||||
import type { Page } from '@blocksuite/store';
|
||||
import type { Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
|
||||
import type { createStore } from 'jotai';
|
||||
import type { FC, PropsWithChildren } from 'react';
|
||||
|
||||
import type { Workspace as RemoteWorkspace } from './affine/api';
|
||||
|
||||
export type JotaiStore = ReturnType<typeof createStore>;
|
||||
|
||||
export const enum WorkspaceSubPath {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import type { createWorkspaceApis } from '@affine/workspace/affine/api';
|
||||
import { rootStore, rootWorkspacesMetadataAtom } from '@affine/workspace/atom';
|
||||
import { createAffineBlobStorage } from '@affine/workspace/blob';
|
||||
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
|
||||
import type { Generator, StoreOptions } from '@blocksuite/store';
|
||||
import { createIndexeddbStorage, Workspace } from '@blocksuite/store';
|
||||
|
||||
import type { createWorkspaceApis } from './affine/api';
|
||||
import { rootStore, rootWorkspacesMetadataAtom } from './atom';
|
||||
import { createAffineBlobStorage } from './blob';
|
||||
import { createSQLiteStorage } from './blob/sqlite-blob-storage';
|
||||
import { WorkspaceFlavour } from './type';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user