build: prevent tsconfig includes sources outside (#2643)

This commit is contained in:
LongYinan
2023-06-01 17:08:14 +08:00
committed by Himself65
parent 2a31af0973
commit 4ab5457a44
25 changed files with 160 additions and 107 deletions

View File

@@ -1,7 +0,0 @@
/* eslint-disable @typescript-eslint/consistent-type-imports */
// This file contains the main process events
// It will guide preload and main process on the correct event types and payloads
declare type MainIPCHandlerMap = typeof import('./main/src/exposed').handlers;
declare type MainIPCEventMap = typeof import('./main/src/exposed').events;

View File

@@ -6,6 +6,8 @@ import { v4 } from 'uuid';
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
import * as Y from 'yjs';
import type { MainIPCHandlerMap } from '../exposed';
const registeredHandlers = new Map<
string,
((...args: any[]) => Promise<any>)[]

View File

@@ -30,3 +30,7 @@ export const getExposedMeta = () => {
events: eventsMeta,
};
};
export type MainIPCHandlerMap = typeof handlers;
export type MainIPCEventMap = typeof events;

View File

@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/consistent-type-imports */
interface Window {
apis: typeof import('./src/affine-apis').apis;
events: typeof import('./src/affine-apis').events;
declare interface Window {
apis: import('./src/affine-apis').PreloadHandlers;
events: import('./src/affine-apis').MainIPCEventMap;
}

View File

@@ -1,10 +1,14 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="../../constraints.d.ts" />
// NOTE: we will generate preload types from this file
import { ipcRenderer } from 'electron';
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import type {
MainIPCEventMap,
MainIPCHandlerMap,
} from '../../main/src/exposed';
type WithoutFirstParameter<T> = T extends (_: any, ...args: infer P) => infer R
? (...args: P) => R
: T;
@@ -15,7 +19,7 @@ type HandlersMap<N extends keyof MainIPCHandlerMap> = {
>;
};
type PreloadHandlers = {
export type PreloadHandlers = {
[N in keyof MainIPCHandlerMap]: HandlersMap<N>;
};
@@ -88,3 +92,6 @@ const appInfo = {
};
export { apis, appInfo, events };
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
export type { MainIPCEventMap } from '../../main/src/exposed';

View File

@@ -11,7 +11,8 @@
"outDir": "dist",
"moduleResolution": "node",
"resolveJsonModule": true,
"noImplicitOverride": true
"noImplicitOverride": true,
"noEmit": false
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "out", "dist"],

View File

@@ -1,14 +1,11 @@
import { Empty } from '@affine/component';
import type {
ListData,
TrashListData,
View,
} from '@affine/component/page-list';
import type { ListData, TrashListData } from '@affine/component/page-list';
import {
filterByFilterList,
PageList,
PageListTrashView,
} from '@affine/component/page-list';
import type { View } from '@affine/component/page-list/filter/shared-types';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { EdgelessIcon, PageIcon } from '@blocksuite/icons';
import type { PageMeta } from '@blocksuite/store';