Compare commits

..

3 Commits

Author SHA1 Message Date
liuyi
41c8232472 chore(infra): remove blocksuite from infra (#9353) 2024-12-26 13:43:12 +00:00
forehalo
126d576c3e fix(electron): remove blocksuite dep 2024-12-26 21:00:51 +08:00
forehalo
a145986de6 ci: wrong script to build electron renderer 2024-12-26 20:47:58 +08:00
14 changed files with 34 additions and 24 deletions

View File

@@ -1,7 +1,6 @@
export * from './app-config-storage';
export * from './atom';
export * from './framework';
export * from './initialization';
export * from './livedata';
export * from './orm';
export * from './storage';

View File

@@ -1,5 +1,5 @@
import { DebugLogger } from '@affine/debug';
import { Slot } from '@blocksuite/affine/global/utils';
import EventEmitter2 from 'eventemitter2';
import { difference } from 'lodash-es';
import { LiveData } from '../../livedata';
@@ -32,13 +32,19 @@ export interface BlobStatus {
export class BlobEngine {
readonly name = 'blob-engine';
readonly readonly = this.local.readonly;
readonly event = new EventEmitter2();
private abort: AbortController | null = null;
readonly isStorageOverCapacity$ = new LiveData(false);
singleBlobSizeLimit: number = 100 * 1024 * 1024;
onAbortLargeBlob = new Slot<Blob>();
onAbortLargeBlob = (callback: (blob: Blob) => void) => {
this.event.on('abort-large-blob', callback);
return () => {
this.event.off('abort-large-blob', callback);
};
};
constructor(
private readonly local: BlobStorage,
@@ -153,7 +159,7 @@ export class BlobEngine {
}
if (value.size > this.singleBlobSizeLimit) {
this.onAbortLargeBlob.emit(value);
this.event.emit('abort-large-blob', value);
logger.error('blob over limit, abort set');
return key;
}

View File

@@ -12,9 +12,6 @@
},
{
"path": "../debug"
},
{
"path": "../../../blocksuite/affine/all"
}
]
}

View File

@@ -15,6 +15,9 @@
},
{
"path": "../infra"
},
{
"path": "../../../blocksuite/affine/all"
}
]
}

View File

@@ -46,7 +46,7 @@ const cwd = repoRootDir;
// step 1: build web dist
if (!process.env.SKIP_WEB_BUILD) {
spawnSync('yarn', ['affine', '@affine/electron', 'bundle'], {
spawnSync('yarn', ['affine', '@affine/electron-renderer', 'build'], {
stdio: 'inherit',
env: process.env,
cwd,

View File

@@ -1,4 +1,3 @@
import { assertExists } from '@blocksuite/affine/global/utils';
import { AsyncCall } from 'async-call-rpc';
import type { HelperToMain, MainToHelper } from '../shared/type';
@@ -6,7 +5,9 @@ import { exposed } from './provide';
const helperToMainServer: HelperToMain = {
getMeta: () => {
assertExists(exposed);
if (!exposed) {
throw new Error('Helper is not initialized correctly');
}
return exposed;
},
};

View File

@@ -88,9 +88,9 @@ export const CloudQuotaModal = () => {
currentWorkspace.engine.blob.singleBlobSizeLimit = workspaceQuota.blobLimit;
const disposable =
currentWorkspace.engine.blob.onAbortLargeBlob.on(onAbortLargeBlob);
currentWorkspace.engine.blob.onAbortLargeBlob(onAbortLargeBlob);
return () => {
disposable?.dispose();
disposable();
};
}, [currentWorkspace.engine.blob, onAbortLargeBlob, workspaceQuota]);

View File

@@ -16,13 +16,13 @@ export const LocalQuotaModal = () => {
}, [setOpen]);
useEffect(() => {
const disposable = currentWorkspace.engine.blob.onAbortLargeBlob.on(() => {
const disposable = currentWorkspace.engine.blob.onAbortLargeBlob(() => {
setOpen(true);
});
return () => {
disposable?.dispose();
disposable();
};
}, [currentWorkspace.engine.blob.onAbortLargeBlob, setOpen]);
}, [currentWorkspace.engine.blob, setOpen]);
return (
<ConfirmModal

View File

@@ -67,12 +67,13 @@ import {
import { Bound } from '@blocksuite/affine/global/utils';
import { type BlockSnapshot, Text } from '@blocksuite/affine/store';
import type { ReferenceParams } from '@blocksuite/affine-model';
import { type DocProps, type FrameworkProvider } from '@toeverything/infra';
import { type FrameworkProvider } from '@toeverything/infra';
import { type TemplateResult } from 'lit';
import { customElement } from 'lit/decorators.js';
import { literal } from 'lit/static-html.js';
import { pick } from 'lodash-es';
import type { DocProps } from '../../../../../blocksuite/initialization';
import { generateUrl } from '../../../../hooks/affine/use-share-url';
import { createKeyboardToolbarConfig } from './widgets/keyboard-toolbar';

View File

@@ -1,11 +1,12 @@
import { toast } from '@affine/component';
import type { DocProps } from '@affine/core/blocksuite/initialization';
import { AppSidebarService } from '@affine/core/modules/app-sidebar';
import { DocsService } from '@affine/core/modules/doc';
import { EditorSettingService } from '@affine/core/modules/editor-setting';
import { WorkbenchService } from '@affine/core/modules/workbench';
import { type DocMode } from '@blocksuite/affine/blocks';
import type { DocCollection } from '@blocksuite/affine/store';
import { type DocProps, useServices } from '@toeverything/infra';
import { useServices } from '@toeverything/infra';
import { useCallback, useMemo } from 'react';
export const usePageHelper = (docCollection: DocCollection) => {

View File

@@ -3,13 +3,12 @@ import { Unreachable } from '@affine/env/constant';
import type { DocMode } from '@blocksuite/affine/blocks';
import type { DeltaInsert } from '@blocksuite/affine/inline';
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
import { ObjectPool, Service } from '@toeverything/infra';
import {
type DocProps,
initDocFromProps,
ObjectPool,
Service,
} from '@toeverything/infra';
} from '../../../blocksuite/initialization';
import type { Doc } from '../entities/doc';
import { DocPropertyList } from '../entities/property-list';
import { DocRecordList } from '../entities/record-list';

View File

@@ -1,8 +1,11 @@
import { Text } from '@blocksuite/affine/store';
import type { DocProps } from '@toeverything/infra';
import { initDocFromProps, LiveData, Service } from '@toeverything/infra';
import { LiveData, Service } from '@toeverything/infra';
import dayjs from 'dayjs';
import {
type DocProps,
initDocFromProps,
} from '../../../blocksuite/initialization';
import type { DocsService } from '../../doc';
import type { EditorSettingService } from '../../editor-setting';
import type { JournalStore } from '../store/journal';

View File

@@ -1,8 +1,8 @@
import { track } from '@affine/track';
import { Text } from '@blocksuite/affine/store';
import type { DocProps } from '@toeverything/infra';
import { Service } from '@toeverything/infra';
import type { DocProps } from '../../../blocksuite/initialization';
import type { DocsService } from '../../doc';
import { EditorSettingService } from '../../editor-setting';
import type { WorkbenchService } from '../../workbench';