build: use tsconfig bundler (#3581)

This commit is contained in:
Alex Yang
2023-08-04 17:00:36 -07:00
committed by GitHub
parent bbf5f0efe0
commit 97de0ef5b4
21 changed files with 116 additions and 221 deletions
+54
View File
@@ -0,0 +1,54 @@
import type { Environment, Platform, RuntimeConfig } from '@affine/env/global';
import type {
DBHandlerManager,
DebugHandlerManager,
DialogHandlerManager,
ExportHandlerManager,
UIHandlerManager,
UnwrapManagerHandlerToClientSide,
UpdaterHandlerManager,
WorkspaceHandlerManager,
} from '@toeverything/infra';
declare global {
interface Window {
appInfo: {
electron: boolean;
};
apis: {
db: UnwrapManagerHandlerToClientSide<DBHandlerManager>;
debug: UnwrapManagerHandlerToClientSide<DebugHandlerManager>;
dialog: UnwrapManagerHandlerToClientSide<DialogHandlerManager>;
export: UnwrapManagerHandlerToClientSide<ExportHandlerManager>;
ui: UnwrapManagerHandlerToClientSide<UIHandlerManager>;
updater: UnwrapManagerHandlerToClientSide<UpdaterHandlerManager>;
workspace: UnwrapManagerHandlerToClientSide<WorkspaceHandlerManager>;
};
events: any;
}
interface WindowEventMap {
'migration-done': CustomEvent;
}
// eslint-disable-next-line no-var
var process: {
env: Record<string, string>;
};
// eslint-disable-next-line no-var
var $migrationDone: boolean;
// eslint-disable-next-line no-var
var platform: Platform | undefined;
// eslint-disable-next-line no-var
var environment: Environment;
// eslint-disable-next-line no-var
var runtimeConfig: RuntimeConfig;
// eslint-disable-next-line no-var
var $AFFINE_SETUP: boolean | undefined;
// eslint-disable-next-line no-var
var editorVersion: string | undefined;
// eslint-disable-next-line no-var
var prefixUrl: string;
// eslint-disable-next-line no-var
var websocketPrefixUrl: string;
}
+10
View File
@@ -0,0 +1,10 @@
{
"name": "@types/affine__env",
"private": true,
"types": "./__all.d.ts",
"type": "module",
"dependencies": {
"@affine/env": "workspace:*",
"@toeverything/infra": "workspace:*"
}
}
@@ -1,7 +1,7 @@
import type { Collection, Filter, VariableMap } from '@affine/env/filter';
import type { DBSchema } from 'idb';
import type { IDBPDatabase } from 'idb';
import { openDB } from 'idb';
import type { IDBPDatabase } from 'idb/build/entry';
import { useAtom } from 'jotai';
import { atomWithReset, RESET } from 'jotai/utils';
import { useCallback } from 'react';
+1 -2
View File
@@ -5,8 +5,7 @@
"compilerOptions": {
"composite": true,
"noEmit": false,
"outDir": "lib",
"types": ["@affine/env"]
"outDir": "lib"
},
"references": [
{
-1
View File
@@ -4,7 +4,6 @@
"type": "module",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/global.ts",
"devDependencies": {
"@blocksuite/global": "0.0.0-20230804190636-37f66904-nightly",
"react": "18.2.0",
-50
View File
@@ -1,60 +1,10 @@
/// <reference types="@blocksuite/global" />
import { assertEquals } from '@blocksuite/global/utils';
import type {
DBHandlerManager,
DebugHandlerManager,
DialogHandlerManager,
ExportHandlerManager,
UIHandlerManager,
UnwrapManagerHandlerToClientSide,
UpdaterHandlerManager,
WorkspaceHandlerManager,
} from '@toeverything/infra';
import { z } from 'zod';
import { isBrowser, isDesktop, isServer } from './constant.js';
import { isValidIPAddress } from './is-valid-ip-address.js';
import { UaHelper } from './ua-helper.js';
declare global {
interface Window {
appInfo: {
electron: boolean;
};
apis: {
db: UnwrapManagerHandlerToClientSide<DBHandlerManager>;
debug: UnwrapManagerHandlerToClientSide<DebugHandlerManager>;
dialog: UnwrapManagerHandlerToClientSide<DialogHandlerManager>;
export: UnwrapManagerHandlerToClientSide<ExportHandlerManager>;
ui: UnwrapManagerHandlerToClientSide<UIHandlerManager>;
updater: UnwrapManagerHandlerToClientSide<UpdaterHandlerManager>;
workspace: UnwrapManagerHandlerToClientSide<WorkspaceHandlerManager>;
};
events: any;
}
interface WindowEventMap {
'migration-done': CustomEvent;
}
// eslint-disable-next-line no-var
var $migrationDone: boolean;
// eslint-disable-next-line no-var
var platform: Platform | undefined;
// eslint-disable-next-line no-var
var environment: Environment;
// eslint-disable-next-line no-var
var runtimeConfig: RuntimeConfig;
// eslint-disable-next-line no-var
var $AFFINE_SETUP: boolean | undefined;
// eslint-disable-next-line no-var
var editorVersion: string | undefined;
// eslint-disable-next-line no-var
var prefixUrl: string;
// eslint-disable-next-line no-var
var websocketPrefixUrl: string;
}
export const blockSuiteFeatureFlags = z.object({
enable_database: z.boolean(),
enable_drag_handle: z.boolean(),
+1 -1
View File
@@ -1,4 +1,4 @@
import type { DBSchema, IDBPDatabase } from 'idb/build/entry';
import type { DBSchema, IDBPDatabase } from 'idb';
export const dbVersion = 1;
export const DEFAULT_DB_NAME = 'affine-local';
+1 -1
View File
@@ -1,5 +1,5 @@
import type { IDBPDatabase } from 'idb';
import { openDB } from 'idb';
import type { IDBPDatabase } from 'idb/build/entry';
import { mergeUpdates } from 'yjs';
import type { BlockSuiteBinaryDB, OldYjsDB, UpdateMessage } from './shared';