chore: standardize tsconfig (#9568)

This commit is contained in:
forehalo 2025-01-08 04:07:56 +00:00
parent 39f4b17315
commit c0ed74dfed
No known key found for this signature in database
GPG Key ID: 56709255DC7EC728
151 changed files with 1041 additions and 1566 deletions

View File

@ -1,20 +1,18 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../../framework/block-std" },
"path": "../../framework" { "path": "../../blocks" },
}, { "path": "../../framework/global" },
{ { "path": "../../framework/inline" },
"path": "../../blocks" { "path": "../../presets" },
}, { "path": "../../framework/store" },
{ { "path": "../../framework/sync" }
"path": "../../presets"
}
] ]
} }

View File

@ -1,29 +1,20 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../block-embed" },
"path": "../../framework" { "path": "../block-surface" },
}, { "path": "../components" },
{ { "path": "../model" },
"path": "../model" { "path": "../shared" },
}, { "path": "../../framework/block-std" },
{ { "path": "../../framework/global" },
"path": "../components" { "path": "../../framework/inline" },
}, { "path": "../../framework/store" }
{
"path": "../shared"
},
{
"path": "../block-embed"
},
{
"path": "../block-surface"
}
] ]
} }

View File

@ -1,26 +1,19 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../block-embed" },
"path": "../../framework" { "path": "../components" },
}, { "path": "../model" },
{ { "path": "../shared" },
"path": "../model" { "path": "../../framework/block-std" },
}, { "path": "../../framework/global" },
{ { "path": "../../framework/inline" },
"path": "../components" { "path": "../../framework/store" }
},
{
"path": "../shared"
},
{
"path": "../block-embed"
}
] ]
} }

View File

@ -1,23 +1,18 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../components" },
"path": "../../framework" { "path": "../model" },
}, { "path": "../shared" },
{ { "path": "../../framework/block-std" },
"path": "../model" { "path": "../../framework/global" },
}, { "path": "../../framework/inline" },
{ { "path": "../../framework/store" }
"path": "../components"
},
{
"path": "../shared"
}
] ]
} }

View File

@ -1,29 +1,20 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../block-database" },
"path": "../../framework" { "path": "../components" },
}, { "path": "../model" },
{ { "path": "../shared" },
"path": "../model" { "path": "../../framework/block-std" },
}, { "path": "../data-view" },
{ { "path": "../../framework/global" },
"path": "../components" { "path": "../../framework/inline" },
}, { "path": "../../framework/store" }
{
"path": "../shared"
},
{
"path": "../data-view"
},
{
"path": "../block-database"
}
] ]
} }

View File

@ -1,29 +1,20 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../components" },
"path": "../../framework" { "path": "../model" },
}, { "path": "../shared" },
{ { "path": "../widget-drag-handle" },
"path": "../model" { "path": "../../framework/block-std" },
}, { "path": "../data-view" },
{ { "path": "../../framework/global" },
"path": "../components" { "path": "../../framework/inline" },
}, { "path": "../../framework/store" }
{
"path": "../shared"
},
{
"path": "../data-view"
},
{
"path": "../widget-drag-handle"
}
] ]
} }

View File

@ -1,23 +1,18 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../components" },
"path": "../../framework" { "path": "../model" },
}, { "path": "../shared" },
{ { "path": "../../framework/block-std" },
"path": "../model" { "path": "../../framework/global" },
}, { "path": "../../framework/inline" },
{ { "path": "../../framework/store" }
"path": "../components"
},
{
"path": "../shared"
}
] ]
} }

View File

@ -1,26 +1,19 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../block-surface" },
"path": "../../framework" { "path": "../components" },
}, { "path": "../model" },
{ { "path": "../shared" },
"path": "../model" { "path": "../../framework/block-std" },
}, { "path": "../../framework/global" },
{ { "path": "../../framework/inline" },
"path": "../components" { "path": "../../framework/store" }
},
{
"path": "../shared"
},
{
"path": "../block-surface"
}
] ]
} }

View File

@ -1,26 +1,19 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../block-surface" },
"path": "../../framework" { "path": "../components" },
}, { "path": "../model" },
{ { "path": "../shared" },
"path": "../model" { "path": "../../framework/block-std" },
}, { "path": "../../framework/global" },
{ { "path": "../../framework/inline" },
"path": "../components" { "path": "../../framework/store" }
},
{
"path": "../shared"
},
{
"path": "../block-surface"
}
] ]
} }

View File

@ -1,23 +1,18 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../components" },
"path": "../../framework" { "path": "../model" },
}, { "path": "../shared" },
{ { "path": "../../framework/block-std" },
"path": "../model" { "path": "../../framework/global" },
}, { "path": "../../framework/inline" },
{ { "path": "../../framework/store" }
"path": "../components"
},
{
"path": "../shared"
}
] ]
} }

View File

@ -1,23 +1,18 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../components" },
"path": "../../framework" { "path": "../model" },
}, { "path": "../shared" },
{ { "path": "../../framework/block-std" },
"path": "../model" { "path": "../../framework/global" },
}, { "path": "../../framework/inline" },
{ { "path": "../../framework/store" }
"path": "../components"
},
{
"path": "../shared"
}
] ]
} }

View File

@ -1,26 +1,19 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../block-note" },
"path": "../../framework" { "path": "../components" },
}, { "path": "../model" },
{ { "path": "../shared" },
"path": "../model" { "path": "../../framework/block-std" },
}, { "path": "../../framework/global" },
{ { "path": "../../framework/inline" },
"path": "../components" { "path": "../../framework/store" }
},
{
"path": "../shared"
},
{
"path": "../block-note"
}
] ]
} }

View File

@ -1,23 +1,18 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../components" },
"path": "../../framework" { "path": "../model" },
}, { "path": "../shared" },
{ { "path": "../../framework/block-std" },
"path": "../model" { "path": "../../framework/global" },
}, { "path": "../../framework/inline" },
{ { "path": "../../framework/store" }
"path": "../components"
},
{
"path": "../shared"
}
] ]
} }

View File

@ -1,29 +1,20 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../block-embed" },
"path": "../../framework" { "path": "../block-surface" },
}, { "path": "../components" },
{ { "path": "../model" },
"path": "../model" { "path": "../shared" },
}, { "path": "../../framework/block-std" },
{ { "path": "../../framework/global" },
"path": "../components" { "path": "../../framework/inline" },
}, { "path": "../../framework/store" }
{
"path": "../shared"
},
{
"path": "../block-embed"
},
{
"path": "../block-surface"
}
] ]
} }

View File

@ -1,23 +1,18 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../components" },
"path": "../../framework" { "path": "../model" },
}, { "path": "../shared" },
{ { "path": "../../framework/block-std" },
"path": "../model" { "path": "../../framework/global" },
}, { "path": "../../framework/inline" },
{ { "path": "../../framework/store" }
"path": "../components"
},
{
"path": "../shared"
}
] ]
} }

View File

@ -1,23 +1,19 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../block-surface" },
"path": "../../framework" { "path": "../components" },
}, { "path": "../model" },
{ { "path": "../shared" },
"path": "../model" { "path": "../../framework/block-std" },
}, { "path": "../../framework/global" },
{ { "path": "../../framework/inline" },
"path": "../components" { "path": "../../framework/store" }
},
{
"path": "../shared"
}
] ]
} }

View File

@ -1,23 +1,18 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../components" },
"path": "../../framework" { "path": "../model" },
}, { "path": "../shared" },
{ { "path": "../../framework/block-std" },
"path": "../model" { "path": "../../framework/global" },
}, { "path": "../../framework/inline" },
{ { "path": "../../framework/store" }
"path": "../components"
},
{
"path": "../shared"
}
] ]
} }

View File

@ -1,20 +1,17 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../model" },
"path": "../../framework" { "path": "../shared" },
}, { "path": "../../framework/block-std" },
{ { "path": "../../framework/global" },
"path": "../shared" { "path": "../../framework/inline" },
}, { "path": "../../framework/store" }
{
"path": "../model"
}
] ]
} }

View File

@ -1,21 +1,17 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "noUncheckedIndexedAccess": true,
"outDir": "./dist/", "rootDir": "./src",
"noEmit": false, "outDir": "./dist",
"noUncheckedIndexedAccess": true "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../components" },
"path": "../components" { "path": "../shared" },
}, { "path": "../../framework/block-std" },
{ { "path": "../../framework/global" },
"path": "../shared" { "path": "../../framework/store" }
},
{
"path": "../../framework"
}
] ]
} }

View File

@ -1,14 +1,15 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../../framework/block-std" },
"path": "../../framework" { "path": "../../framework/global" },
} { "path": "../../framework/inline" },
{ "path": "../../framework/store" }
] ]
} }

View File

@ -1,17 +1,16 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../model" },
"path": "../../framework" { "path": "../../framework/block-std" },
}, { "path": "../../framework/global" },
{ { "path": "../../framework/inline" },
"path": "../model" { "path": "../../framework/store" }
}
] ]
} }

View File

@ -1,35 +1,22 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../block-list" },
"path": "../../framework" { "path": "../block-note" },
}, { "path": "../block-paragraph" },
{ { "path": "../block-surface" },
"path": "../model" { "path": "../components" },
}, { "path": "../model" },
{ { "path": "../shared" },
"path": "../components" { "path": "../../framework/block-std" },
}, { "path": "../../framework/global" },
{ { "path": "../../framework/inline" },
"path": "../shared" { "path": "../../framework/store" }
},
{
"path": "../block-paragraph"
},
{
"path": "../block-surface"
},
{
"path": "../block-note"
},
{
"path": "../block-list"
}
] ]
} }

View File

@ -1,20 +1,15 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../model" },
"path": "../../framework" { "path": "../shared" },
}, { "path": "../../framework/block-std" },
{ { "path": "../../framework/global" }
"path": "../model"
},
{
"path": "../shared"
}
] ]
} }

View File

@ -1,20 +1,15 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../model" },
"path": "../../framework" { "path": "../shared" },
}, { "path": "../../framework/block-std" },
{ { "path": "../../framework/global" }
"path": "../model"
},
{
"path": "../shared"
}
] ]
} }

View File

@ -1,20 +1,15 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../model" },
"path": "../../framework" { "path": "../shared" },
}, { "path": "../../framework/block-std" },
{ { "path": "../../framework/global" }
"path": "../model"
},
{
"path": "../shared"
}
] ]
} }

View File

@ -1,86 +1,39 @@
{ {
"extends": "../tsconfig.json", "extends": "../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../affine/block-attachment" },
"path": "../framework" { "path": "../affine/block-bookmark" },
}, { "path": "../affine/block-code" },
{ { "path": "../affine/block-data-view" },
"path": "../affine/model" { "path": "../affine/block-database" },
}, { "path": "../affine/block-divider" },
{ { "path": "../affine/block-edgeless-text" },
"path": "../affine/shared" { "path": "../affine/block-embed" },
}, { "path": "../affine/block-frame" },
{ { "path": "../affine/block-image" },
"path": "../affine/components" { "path": "../affine/block-latex" },
}, { "path": "../affine/block-list" },
{ { "path": "../affine/block-note" },
"path": "../affine/block-paragraph" { "path": "../affine/block-paragraph" },
}, { "path": "../affine/block-surface" },
{ { "path": "../affine/block-surface-ref" },
"path": "../affine/block-latex" { "path": "../affine/components" },
}, { "path": "../affine/model" },
{ { "path": "../affine/shared" },
"path": "../affine/block-list" { "path": "../affine/widget-drag-handle" },
}, { "path": "../affine/widget-frame-title" },
{ { "path": "../affine/widget-remote-selection" },
"path": "../affine/block-code" { "path": "../affine/widget-scroll-anchoring" },
}, { "path": "../framework/block-std" },
{ { "path": "../affine/data-view" },
"path": "../affine/block-embed" { "path": "../framework/global" },
}, { "path": "../framework/inline" },
{ { "path": "../framework/store" }
"path": "../affine/block-frame"
},
{
"path": "../affine/block-note"
},
{
"path": "../affine/block-bookmark"
},
{
"path": "../affine/block-database"
},
{
"path": "../affine/block-attachment"
},
{
"path": "../affine/block-image"
},
{
"path": "../affine/block-edgeless-text"
},
{
"path": "../affine/block-divider"
},
{
"path": "../affine/block-surface"
},
{
"path": "../affine/block-surface-ref"
},
{
"path": "../affine/block-data-view"
},
{
"path": "../affine/data-view"
},
{
"path": "../affine/widget-scroll-anchoring"
},
{
"path": "../affine/widget-remote-selection"
},
{
"path": "../affine/widget-drag-handle"
},
{
"path": "../affine/widget-frame-title"
}
] ]
} }

View File

@ -1,20 +1,14 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../global" },
"path": "../global" { "path": "../inline" },
}, { "path": "../store" }
{
"path": "../store"
},
{
"path": "../inline"
}
] ]
} }

View File

@ -1,11 +1,11 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src", "index.d.ts"], "include": ["./src"],
// This package MUST NOT use any other package. // This package MUST NOT use any other package.
"references": [] "references": []
} }

View File

@ -1,14 +1,10 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [{ "path": "../global" }]
{
"path": "../global"
}
]
} }

View File

@ -1,20 +1,14 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ { "path": "../global" },
"path": "../global" { "path": "../inline" },
}, { "path": "../sync" }
{
"path": "../sync"
},
{
"path": "../inline"
}
] ]
} }

View File

@ -1,14 +1,10 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src", "index.d.ts"], "include": ["./src"],
"references": [ "references": [{ "path": "../global" }]
{
"path": "../global"
}
]
} }

View File

@ -1,20 +1,21 @@
{ {
"extends": "../tsconfig.json", "extends": "../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"target": "ESNext", "rootDir": ".",
"useDefineForClassFields": false, "outDir": "./dist",
"lib": ["DOM", "DOM.Iterable", "ESNext"], "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"noEmit": true,
"composite": false
}, },
"include": ["./apps", "./examples"], "include": ["./apps", "./examples"],
"references": [{ "path": "./tsconfig.node.json" }] "references": [
{ "path": "../affine/components" },
{ "path": "../affine/model" },
{ "path": "../framework/block-std" },
{ "path": "../blocks" },
{ "path": "../affine/data-view" },
{ "path": "../framework/global" },
{ "path": "../framework/inline" },
{ "path": "../presets" },
{ "path": "../framework/store" },
{ "path": "../framework/sync" }
]
} }

View File

@ -1,9 +1,11 @@
{ {
"extends": "../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"composite": true, "allowSyntheticDefaultImports": true,
"module": "ESNext", "noUncheckedIndexedAccess": false,
"moduleResolution": "Node", "rootDir": ".",
"allowSyntheticDefaultImports": true "outDir": "./lib",
"tsBuildInfoFile": "./lib/tsconfig.tsbuildinfo"
}, },
"include": ["vite.config.ts", "./scripts"] "include": ["vite.config.ts", "./scripts"]
} }

View File

@ -29,6 +29,8 @@ export function sourcemapExclude(): Plugin {
map: { mappings: '' }, map: { mappings: '' },
}; };
} }
return undefined;
}, },
}; };
} }
@ -157,10 +159,10 @@ const clearSiteDataPlugin = () =>
}) as Plugin; }) as Plugin;
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default ({ mode }) => { export default defineConfig(({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, __dirname, '') }; process.env = { ...process.env, ...loadEnv(mode, __dirname, '') };
return defineConfig({ return {
envDir: __dirname, envDir: __dirname,
define: { define: {
'import.meta.env.PLAYGROUND_SERVER': JSON.stringify( 'import.meta.env.PLAYGROUND_SERVER': JSON.stringify(
@ -200,7 +202,10 @@ export default ({ mode }) => {
cache: false, cache: false,
maxParallelFileOps: Math.max(1, cpus().length - 1), maxParallelFileOps: Math.max(1, cpus().length - 1),
onwarn(warning, defaultHandler) { onwarn(warning, defaultHandler) {
if (['EVAL', 'SOURCEMAP_ERROR'].includes(warning.code)) { if (
warning.code &&
['EVAL', 'SOURCEMAP_ERROR'].includes(warning.code)
) {
return; return;
} }
@ -252,10 +257,11 @@ export default ({ mode }) => {
} }
return group; return group;
} }
return undefined;
} }
}, },
}, },
}, },
}, },
}); };
}; });

View File

@ -1,19 +1,19 @@
{ {
"extends": "../tsconfig.json", "extends": "../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"rootDir": "./src/", "rootDir": "./src",
"outDir": "./dist/", "outDir": "./dist",
"noEmit": false, "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
"resolveJsonModule": true,
"esModuleInterop": true
}, },
"include": ["./src", "./src/**/*.json"], "include": ["./src", "./src/**/*.json"],
"references": [ "references": [
{ { "path": "../affine/block-surface" },
"path": "../framework" { "path": "../affine/model" },
}, { "path": "../affine/shared" },
{ { "path": "../framework/block-std" },
"path": "../blocks" { "path": "../blocks" },
} { "path": "../framework/global" },
{ "path": "../framework/inline" },
{ "path": "../framework/store" }
] ]
} }

View File

@ -9,6 +9,7 @@
"dependencies": { "dependencies": {
"@blocksuite/affine-components": "workspace:*", "@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*", "@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*", "@blocksuite/block-std": "workspace:*",
"@blocksuite/global": "workspace:*", "@blocksuite/global": "workspace:*",
"@blocksuite/presets": "workspace:*", "@blocksuite/presets": "workspace:*",

View File

@ -2,8 +2,7 @@
"extends": "../tsconfig.json", "extends": "../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": ".",
"noEmit": true, "outDir": "./dist",
"composite": false,
"paths": { "paths": {
"@blocks/*": ["../blocks/src/*"], "@blocks/*": ["../blocks/src/*"],
"@inline/*": ["../framework/inline/src/*"], "@inline/*": ["../framework/inline/src/*"],
@ -11,5 +10,14 @@
"@playground/*": ["../playground/*"] "@playground/*": ["../playground/*"]
} }
}, },
"include": ["**.spec.ts", "**.test.ts", "**/**.ts"] "include": ["**.spec.ts", "**.test.ts", "**/**.ts"],
"exclude": ["dist"],
"references": [
{ "path": "../affine/components" },
{ "path": "../affine/model" },
{ "path": "../affine/shared" },
{ "path": "../framework/block-std" },
{ "path": "../framework/global" },
{ "path": "../presets" }
]
} }

View File

@ -1,28 +1,7 @@
{ {
"extends": "../tsconfig.json", // exists for easier extending in blocksuite packages
"extends": "../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"useDefineForClassFields": false, "types": []
"module": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"moduleResolution": "Bundler",
"esModuleInterop": true,
"noEmitOnError": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noImplicitOverride": true,
"skipLibCheck": true,
"incremental": true,
"composite": true
},
"files": [],
"ts-node": {
"esm": true,
"experimentalSpecifierResolution": "node",
"compilerOptions": {
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": false
}
} }
} }

View File

@ -60,7 +60,6 @@
"@swc/core": "^1.10.1", "@swc/core": "^1.10.1",
"@taplo/cli": "^0.7.0", "@taplo/cli": "^0.7.0",
"@toeverything/infra": "workspace:*", "@toeverything/infra": "workspace:*",
"@types/affine__env": "workspace:*",
"@types/eslint": "^9.6.1", "@types/eslint": "^9.6.1",
"@types/node": "^20.17.10", "@types/node": "^20.17.10",
"@typescript-eslint/parser": "^8.18.0", "@typescript-eslint/parser": "^8.18.0",

View File

@ -1,9 +1,8 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.node.json",
"compilerOptions": { "compilerOptions": {
"noEmit": false, "outDir": "./dist"
"outDir": "lib",
"composite": true
}, },
"include": ["index.d.ts"] "include": ["index.d.ts"],
"references": []
} }

View File

@ -1,16 +0,0 @@
import crypto from 'node:crypto';
const { privateKey, publicKey } = crypto.generateKeyPairSync('ec', {
namedCurve: 'prime256v1',
publicKeyEncoding: {
type: 'spki',
format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
},
});
console.log('ECDSA Public Key:\n', publicKey);
console.log('ECDSA Private Key:\n', privateKey);

View File

@ -1,18 +0,0 @@
import { createTransport } from 'nodemailer';
const transport = createTransport({
host: '0.0.0.0',
port: 1025,
secure: false,
auth: {
user: 'himself65',
pass: '123456',
},
});
await transport.sendMail({
from: 'noreply@toeverything.info',
to: 'himself65@outlook.com',
subject: 'test',
html: `<div>hello world</div>`,
});

View File

@ -47,7 +47,7 @@ export class CaptchaService {
body: formData, body: formData,
method: 'POST', method: 'POST',
}); });
const outcome = await result.json(); const outcome: any = await result.json();
return ( return (
!!outcome.success && !!outcome.success &&

View File

@ -23,7 +23,7 @@ export class CopilotWorkflowService {
const node = workflow.get(nodeData.id); const node = workflow.get(nodeData.id);
if (!node) { if (!node) {
this.logger.error( this.logger.error(
`Failed to init workflow ${name}: node ${nodeData.id} not found` `Failed to init workflow ${graph.name}: node ${nodeData.id} not found`
); );
throw new Error(`Node ${nodeData.id} not found`); throw new Error(`Node ${nodeData.id} not found`);
} }
@ -31,7 +31,7 @@ export class CopilotWorkflowService {
const edge = workflow.get(edgeId); const edge = workflow.get(edgeId);
if (!edge) { if (!edge) {
this.logger.error( this.logger.error(
`Failed to init workflow ${name}: edge ${edgeId} not found in node ${nodeData.id}` `Failed to init workflow ${graph.name}: edge ${edgeId} not found in node ${nodeData.id}`
); );
throw new Error(`Edge ${edgeId} not found`); throw new Error(`Edge ${edgeId} not found`);
} }

View File

@ -1,23 +0,0 @@
{
"extends": "../../../../tsconfig.json",
"compilerOptions": {
"composite": true,
"target": "ES2022",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"rootDir": ".",
"outDir": "../lib/tests",
"verbatimModuleSyntax": false,
"tsBuildInfoFile": "../lib/tests/.tsbuildinfo"
},
"references": [
{
"path": "../tsconfig.json"
},
{
"path": "../../../../tests/kit/tsconfig.json"
}
],
"include": ["."],
"exclude": []
}

View File

@ -1,33 +1,18 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.node.json",
"compilerOptions": { "compilerOptions": {
"composite": true,
"target": "ES2022",
"module": "ESNext",
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"moduleResolution": "Bundler",
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"isolatedModules": false,
"resolveJsonModule": true,
"types": ["node"],
"outDir": "dist",
"noEmit": false,
"verbatimModuleSyntax": false, "verbatimModuleSyntax": false,
"rootDir": "./src" "rootDir": "./src",
"outDir": "./dist",
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["./src"], "include": ["./src"],
"exclude": ["dist", "lib", "tests"],
"references": [ "references": [
{ { "path": "../../../tests/kit" },
"path": "./tsconfig.node.json" { "path": "../../../tools/cli" },
}, { "path": "../native" }
{ ]
"path": "../native/tsconfig.json"
}
],
"ts-node": {
"esm": true,
"experimentalSpecifierResolution": "node"
}
} }

View File

@ -1,20 +1,10 @@
{ {
"extends": "../../../tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"composite": true, "allowJs": true,
"target": "ESNext", "rootDir": ".",
"module": "ESNext", "outDir": "./lib",
"resolveJsonModule": true, "tsBuildInfoFile": "./lib/tsconfig.tsbuildinfo"
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"outDir": "./lib/scripts",
"rootDir": "."
}, },
"references": [ "include": ["./scripts", "./tests"]
{
"path": "../../../tests/kit"
}
],
"include": ["scripts", "package.json"],
"exclude": ["tests"]
} }

View File

@ -1 +0,0 @@
lib

View File

@ -1,7 +1,9 @@
{ {
"name": "@affine/debug", "name": "@affine/debug",
"private": true, "private": true,
"main": "./src/index.ts", "exports": {
".": "./src/index.ts"
},
"dependencies": { "dependencies": {
"debug": "^4.4.0" "debug": "^4.4.0"
}, },

View File

@ -1,13 +1,10 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"module": "ESNext", "rootDir": "./src",
"target": "ESNext", "outDir": "./dist",
"sourceMap": true, "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
"composite": true,
"noEmit": false,
"outDir": "lib"
}, },
"include": ["./src"], "include": ["./src"],
"exclude": ["node_modules"] "references": []
} }

View File

@ -1 +0,0 @@
lib

View File

@ -1,61 +1,5 @@
import { UaHelper } from './ua-helper.js'; import { UaHelper } from './ua-helper.js';
export type BUILD_CONFIG_TYPE = {
debug: boolean;
distribution: 'web' | 'desktop' | 'admin' | 'mobile' | 'ios' | 'android';
/**
* 'web' | 'desktop' | 'admin'
*/
isDesktopEdition: boolean;
/**
* 'mobile'
*/
isMobileEdition: boolean;
isElectron: boolean;
isWeb: boolean;
isMobileWeb: boolean;
isIOS: boolean;
isAndroid: boolean;
isAdmin: boolean;
// this is for the electron app
/**
* @deprecated need to be refactored
*/
serverUrlPrefix: string;
appVersion: string;
editorVersion: string;
appBuildType: 'stable' | 'beta' | 'internal' | 'canary';
githubUrl: string;
changelogUrl: string;
downloadUrl: string;
// see: tools/workers
imageProxyUrl: string;
linkPreviewUrl: string;
};
export type Environment = {
// Variant
isSelfHosted: boolean;
// Device
isLinux: boolean;
isMacOs: boolean;
isIOS: boolean;
isSafari: boolean;
isWindows: boolean;
isFireFox: boolean;
isMobile: boolean;
isChrome: boolean;
isPwa: boolean;
chromeVersion?: number;
// runtime configs
publicPath: string;
};
export function setupGlobal() { export function setupGlobal() {
if (globalThis.$AFFINE_SETUP) { if (globalThis.$AFFINE_SETUP) {
return; return;

View File

@ -1,9 +1,11 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.web.json",
"include": ["./src"],
"compilerOptions": { "compilerOptions": {
"composite": true, "types": ["build-config", "affine__env"],
"noEmit": false, "rootDir": "./src",
"outDir": "lib" "outDir": "./dist",
} "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
},
"include": ["./src"],
"references": [{ "path": "../../../blocksuite/affine/all" }]
} }

View File

@ -1,17 +1,10 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.web.json",
"include": ["./src"], "include": ["./src"],
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": "./src",
"noEmit": false, "outDir": "./dist",
"outDir": "lib" "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"references": [ "references": [{ "path": "../debug" }, { "path": "../env" }]
{
"path": "../env"
},
{
"path": "../debug"
}
]
} }

View File

@ -1,20 +1,10 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.web.json",
"include": ["./src"], "include": ["./src"],
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": "./src",
"noEmit": false, "outDir": "./dist",
"outDir": "lib" "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"references": [ "references": [{ "path": "../infra" }, { "path": "../../frontend/graphql" }]
{
"path": "../../frontend/graphql"
},
{
"path": "../infra"
},
{
"path": "../../../blocksuite/affine/all"
}
]
} }

View File

@ -67,6 +67,7 @@
"update-shadcn": "shadcn-ui add -p src/components/ui" "update-shadcn": "shadcn-ui add -p src/components/ui"
}, },
"exports": { "exports": {
"./*": "./src/*" "./*": "./src/*.ts",
"./components/ui/*": "./src/components/ui/*.tsx"
} }
} }

View File

@ -6,7 +6,8 @@ import {
ToastTitle, ToastTitle,
ToastViewport, ToastViewport,
} from '@affine/admin/components/ui/toast'; } from '@affine/admin/components/ui/toast';
import { useToast } from '@affine/admin/components/ui/use-toast';
import { useToast } from './use-toast';
export function Toaster() { export function Toaster() {
const { toasts } = useToast(); const { toasts } = useToast();

View File

@ -1,17 +1,15 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.web.json",
"include": ["./src"], "include": ["./src"],
"compilerOptions": { "compilerOptions": {
"rootDir": "./src",
"outDir": "./dist", "outDir": "./dist",
"allowJs": true, "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
"composite": true,
"verbatimModuleSyntax": false,
"jsx": "react-jsx"
}, },
"references": [ "references": [
{ "path": "../component" },
{ "path": "../core" }, { "path": "../core" },
{ "path": "../graphql" }, { "path": "../graphql" },
{ "path": "../../common/infra" } { "path": "../../common/infra" }
], ]
"exclude": ["dist"]
} }

View File

@ -3,7 +3,6 @@
"version": "0.19.0", "version": "0.19.0",
"description": "AFFiNE Desktop Web application", "description": "AFFiNE Desktop Web application",
"private": true, "private": true,
"browser": "src/index.tsx",
"scripts": { "scripts": {
"build": "affine bundle", "build": "affine bundle",
"dev": "affine bundle --dev" "dev": "affine bundle --dev"

View File

@ -1,12 +1,15 @@
{ {
"extends": "../../../../tsconfig.json", "extends": "../../../../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": "./src",
"outDir": "lib", "outDir": "./dist",
"moduleResolution": "Bundler", "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
"types": ["affine__env"],
"rootDir": "./src"
}, },
"include": ["./src"], "include": ["./src"],
"references": [{ "path": "../../core" }] "references": [
{ "path": "../../component" },
{ "path": "../../core" },
{ "path": "../../i18n" },
{ "path": "../../../../blocksuite/affine/all" }
]
} }

View File

@ -1,17 +1,17 @@
{ {
"extends": "../../../../tsconfig.json", "extends": "../../../../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": "./src",
"outDir": "lib", // dist is kept for webpack output
"moduleResolution": "Bundler", "outDir": "./lib",
"types": ["affine__env"], "tsBuildInfoFile": "./lib/tsconfig.tsbuildinfo"
"rootDir": "./src"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ "path": "../../component" },
{ "path": "../../core" }, { "path": "../../core" },
{ { "path": "../../electron-api" },
"path": "../../electron-api" { "path": "../../i18n" },
} { "path": "../../../../tools/utils" }
] ]
} }

View File

@ -10,6 +10,15 @@
}, },
"description": "AFFiNE Desktop App", "description": "AFFiNE Desktop App",
"homepage": "https://github.com/toeverything/AFFiNE", "homepage": "https://github.com/toeverything/AFFiNE",
"exports": {
"./helper/exposed": "./src/helper/exposed.ts",
"./main/exposed": "./src/main/exposed.ts",
"./preload/electron-api": "./src/preload/electron-api.ts",
"./preload/shared-storage": "./src/preload/shared-storage.ts",
"./main/shared-state-schema": "./src/main/shared-state-schema.ts",
"./main/updater/event": "./src/main/updater/event.ts",
"./main/windows-manager": "./src/main/windows-manager/index.ts"
},
"scripts": { "scripts": {
"start": "electron .", "start": "electron .",
"dev": "cross-env DEV_SERVER_URL=http://localhost:8080 node ./scripts/dev.ts", "dev": "cross-env DEV_SERVER_URL=http://localhost:8080 node ./scripts/dev.ts",

View File

@ -106,7 +106,7 @@ export const uiHandlers = {
link = link =
'https://api.fxtwitter.com/status/' + /\/status\/(.*)/.exec(link)?.[1]; 'https://api.fxtwitter.com/status/' + /\/status\/(.*)/.exec(link)?.[1];
try { try {
const { tweet } = await fetch(link).then(res => res.json()); const { tweet } = (await fetch(link).then(res => res.json())) as any;
return { return {
title: tweet.author.name, title: tweet.author.name,
icon: tweet.author.avatar_url, icon: tweet.author.avatar_url,

View File

@ -9,11 +9,14 @@ import {
WebContentViewsManager, WebContentViewsManager,
} from './tab-views'; } from './tab-views';
export const showTabContextMenu = async (tabId: string, viewIndex: number) => { export const showTabContextMenu = async (
tabId: string,
viewIndex: number
): Promise<TabAction | null> => {
const workbenches = WebContentViewsManager.instance.tabViewsMeta.workbenches; const workbenches = WebContentViewsManager.instance.tabViewsMeta.workbenches;
const tabMeta = workbenches.find(w => w.id === tabId); const tabMeta = workbenches.find(w => w.id === tabId);
if (!tabMeta) { if (!tabMeta) {
return; return null;
} }
const { resolve, promise } = Promise.withResolvers<TabAction | null>(); const { resolve, promise } = Promise.withResolvers<TabAction | null>();
@ -93,7 +96,7 @@ export const showTabContextMenu = async (tabId: string, viewIndex: number) => {
]; ];
const menu = Menu.buildFromTemplate(template); const menu = Menu.buildFromTemplate(template);
menu.popup(); menu.popup();
// eslint-disable-next-line prefer-const
let unsub: (() => void) | undefined; let unsub: (() => void) | undefined;
const subscription = WebContentViewsManager.instance.tabAction$.subscribe( const subscription = WebContentViewsManager.instance.tabAction$.subscribe(
action => { action => {

View File

@ -1,4 +1,6 @@
// Please add modules to `external` in `rollupOptions` to avoid wrong bundling. // Please add modules to `external` in `rollupOptions` to avoid wrong bundling.
import type { MessagePort } from 'node:worker_threads';
import type { EventBasedChannel } from 'async-call-rpc'; import type { EventBasedChannel } from 'async-call-rpc';
import { AsyncCall } from 'async-call-rpc'; import { AsyncCall } from 'async-call-rpc';
import { ipcRenderer } from 'electron'; import { ipcRenderer } from 'electron';
@ -135,12 +137,13 @@ const helperPort = new Promise<MessagePort>(resolve =>
const createMessagePortChannel = (port: MessagePort): EventBasedChannel => { const createMessagePortChannel = (port: MessagePort): EventBasedChannel => {
return { return {
on(listener) { on(listener) {
port.onmessage = e => { const listen = (e: MessageEvent) => {
listener(e.data); listener(e.data);
}; };
port.addEventListener('message', listen as any);
port.start(); port.start();
return () => { return () => {
port.onmessage = null; port.removeEventListener('message', listen as any);
try { try {
port.close(); port.close();
} catch (err) { } catch (err) {
@ -246,10 +249,15 @@ export const events = {
...helperAPIs.events, ...helperAPIs.events,
}; };
// Create MessagePort that can be used by web workers /**
* Create MessagePort that can be used by web workers
*
* !!!
* SHOULD ONLY BE USED IN RENDERER PROCESS
* !!!
*/
export function requestWebWorkerPort() { export function requestWebWorkerPort() {
const ch = new MessageChannel(); const ch = new MessageChannel();
const localPort = ch.port1; const localPort = ch.port1;
const remotePort = ch.port2; const remotePort = ch.port2;
@ -274,6 +282,7 @@ export function requestWebWorkerPort() {
const portId = crypto.randomUUID(); const portId = crypto.randomUUID();
setTimeout(() => { setTimeout(() => {
// @ts-expect-error this function should only be evaluated in the renderer process
window.postMessage( window.postMessage(
{ {
type: 'electron:request-api-port', type: 'electron:request-api-port',

View File

@ -1,45 +1,16 @@
{ {
"extends": "../../../../tsconfig.json", "extends": "../../../../tsconfig.node.json",
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": "./src",
"skipLibCheck": true, "outDir": "./dist",
"target": "ES2022", "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
"module": "ESNext",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"types": ["node", "affine__env"],
"outDir": "lib",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"noImplicitOverride": true,
"paths": {
"@toeverything/infra/*": ["../../common/infra/src/*"]
}
}, },
"include": ["./src"], "include": ["./src"],
"exclude": ["renderer", "node_modules", "lib", "dist", "**/__tests__/**/*"],
"references": [ "references": [
{ { "path": "../../../../tests/kit" },
"path": "../../../frontend/native" { "path": "../../../../tools/utils" },
}, { "path": "../../native" },
{ { "path": "../../../common/nbstore" },
"path": "../../../common/infra" { "path": "../../../common/infra" }
}, ]
{
"path": "../../../common/env"
},
{
"path": "./tsconfig.node.json"
},
{
"path": "../../../../tests/kit"
},
{
"path": "../../../../tools/utils"
}
],
"ts-node": {
"esm": true,
"experimentalSpecifierResolution": "node"
}
} }

View File

@ -1,26 +1,9 @@
{ {
"extends": "../../../../tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": ".",
"target": "ESNext", "outDir": "./lib",
"module": "ESNext", "tsBuildInfoFile": "./lib/tsconfig.tsbuildinfo"
"resolveJsonModule": true,
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"noEmit": false,
"outDir": "./lib/scripts",
"types": ["node", "affine__env"],
"allowJs": true
}, },
"include": ["./scripts"], "include": ["./test", "./scripts", "./vitest.config.ts"]
"exclude": ["./renderer"],
"ts-node": {
"esm": true,
"experimentalSpecifierResolution": "node"
},
"references": [
{
"path": "../../../../tools/utils"
}
]
} }

View File

@ -1,21 +0,0 @@
{
"extends": "../../../../tsconfig.json",
"compilerOptions": {
"composite": true,
"target": "ESNext",
"module": "ESNext",
"resolveJsonModule": true,
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"noEmit": false,
"outDir": "./lib/tests",
"types": ["node", "affine__env"],
"allowJs": true
},
"references": [
{
"path": "./tsconfig.json"
}
],
"include": ["./test"]
}

View File

@ -23,7 +23,6 @@ const readFileAsBase64 = (file: File) =>
}); });
const convertFormData = async (formData: FormData) => { const convertFormData = async (formData: FormData) => {
const newFormData = []; const newFormData = [];
// @ts-expect-error FormData.entries
for (const pair of formData.entries()) { for (const pair of formData.entries()) {
const [key, value] = pair; const [key, value] = pair;
if (value instanceof File) { if (value instanceof File) {
@ -47,7 +46,7 @@ const convertBody = async (body: unknown, contentType: string) => {
if (body instanceof ReadableStream) { if (body instanceof ReadableStream) {
const reader = body.getReader(); const reader = body.getReader();
const chunks = []; const chunks = [];
// eslint-disable-next-line no-constant-condition
while (true) { while (true) {
const { done, value } = await reader.read(); const { done, value } = await reader.read();
if (done) break; if (done) break;
@ -129,7 +128,6 @@ export function configureFetchProvider(framework: Framework) {
console.time(tag); console.time(tag);
try { try {
const { body } = request; const { body } = request;
// @ts-expect-error Headers.entries
const optionHeaders = Object.fromEntries(request.headers.entries()); const optionHeaders = Object.fromEntries(request.headers.entries());
const { const {
data: requestData, data: requestData,

View File

@ -50,7 +50,7 @@ function main() {
} }
function mountApp() { function mountApp() {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // oxlint-disable-next-line @typescript-eslint/no-non-null-assertion
const root = document.getElementById('app')!; const root = document.getElementById('app')!;
createRoot(root).render( createRoot(root).render(
<StrictMode> <StrictMode>

View File

@ -1,16 +1,17 @@
{ {
"extends": "../../../../tsconfig.json", "extends": "../../../../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": "./src",
"outDir": "lib", "outDir": "./dist",
"moduleResolution": "Bundler", "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
"types": ["affine__env"],
"rootDir": "./src"
}, },
"include": ["./src"], "include": ["./src"],
"references": [ "references": [
{ "path": "../../component" },
{ "path": "../../core" }, { "path": "../../core" },
{ "path": "../../native" }, { "path": "../../i18n" },
{ "path": "../../../common/nbstore" } { "path": "../../../../blocksuite/affine/all" },
{ "path": "../../../common/infra" },
{ "path": "../../native" }
] ]
} }

View File

@ -1,12 +1,15 @@
{ {
"extends": "../../../../tsconfig.json", "extends": "../../../../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": "./src",
"outDir": "lib", "outDir": "./dist",
"moduleResolution": "Bundler", "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
"types": ["affine__env"],
"rootDir": "./src"
}, },
"include": ["./src"], "include": ["./src"],
"references": [{ "path": "../../core" }] "references": [
{ "path": "../../component" },
{ "path": "../../core" },
{ "path": "../../i18n" },
{ "path": "../../../../blocksuite/affine/all" }
]
} }

View File

@ -43,7 +43,7 @@ function main() {
} }
function mountApp() { function mountApp() {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // oxlint-disable-next-line @typescript-eslint/no-non-null-assertion
const root = document.getElementById('app')!; const root = document.getElementById('app')!;
createRoot(root).render( createRoot(root).render(
<StrictMode> <StrictMode>

View File

@ -1,12 +1,14 @@
{ {
"extends": "../../../../tsconfig.json", "extends": "../../../../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": "./src",
"outDir": "lib", "outDir": "./dist",
"moduleResolution": "Bundler", "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
"types": ["affine__env"],
"rootDir": "./src"
}, },
"include": ["./src"], "include": ["./src"],
"references": [{ "path": "../../core" }] "references": [
{ "path": "../../component" },
{ "path": "../../core" },
{ "path": "../../i18n" }
]
} }

View File

@ -2,7 +2,6 @@ import { ArrowRightSmallIcon } from '@blocksuite/icons/rc';
import clsx from 'clsx'; import clsx from 'clsx';
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import type { Location } from 'react-router-dom'; import type { Location } from 'react-router-dom';
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { useLocation, useNavigate } from 'react-router-dom'; import { useLocation, useNavigate } from 'react-router-dom';
import useSWR from 'swr'; import useSWR from 'swr';

View File

@ -1,5 +1,6 @@
export { export {
type GlobalLoadingEvent, type GlobalLoadingEvent,
globalLoadingEventsAtom,
pushGlobalLoadingEventAtom, pushGlobalLoadingEventAtom,
resolveGlobalLoadingEventAtom, resolveGlobalLoadingEventAtom,
} from './index.jotai'; } from './index.jotai';

View File

@ -1,6 +1,5 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.web.json",
"exclude": ["lib"],
"include": [ "include": [
"./src/**/*", "./src/**/*",
"./src/**/*.json", "./src/**/*.json",
@ -8,25 +7,15 @@
"./.storybook" "./.storybook"
], ],
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": ".",
"noEmit": false, "outDir": "./dist",
"outDir": "lib" "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"references": [ "references": [
{ { "path": "../../common/debug" },
"path": "../../frontend/i18n" { "path": "../electron-api" },
}, { "path": "../graphql" },
{ { "path": "../i18n" },
"path": "../../frontend/electron-api" { "path": "../../../blocksuite/affine/all" }
},
{
"path": "../../frontend/graphql"
},
{
"path": "../../common/debug"
},
{
"path": "../../common/infra"
}
] ]
} }

View File

@ -1,5 +1,5 @@
import { Loading } from '@affine/component'; import { Loading } from '@affine/component';
import { globalLoadingEventsAtom } from '@affine/component/global-loading/index.jotai'; import { globalLoadingEventsAtom } from '@affine/component/global-loading';
import { useAtomValue } from 'jotai'; import { useAtomValue } from 'jotai';
import { type ReactNode, useEffect, useState } from 'react'; import { type ReactNode, useEffect, useState } from 'react';

View File

@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* oxlint-disable @typescript-eslint/no-non-null-assertion */
import { Entity } from '@toeverything/infra'; import { Entity } from '@toeverything/infra';
import type { DesktopApiProvider } from '../provider'; import type { DesktopApiProvider } from '../provider';

View File

@ -1,5 +1,5 @@
import type { AppInfo } from '@affine/electron/preload/electron-api';
import type { import type {
AppInfo,
ClientEvents, ClientEvents,
ClientHandler, ClientHandler,
SharedStorage, SharedStorage,

View File

@ -1,33 +1,19 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"outDir": "lib", "rootDir": "./src",
"typeRoots": ["../../../node_modules", "../../../node_modules/@types"], "outDir": "./dist",
"types": ["webpack-env", "ses", "affine__env"] "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.json"], "include": ["./src", "src/**/*.json"],
"exclude": ["node_modules"],
"references": [ "references": [
{ { "path": "../component" },
"path": "../../frontend/component" { "path": "../../common/debug" },
}, { "path": "../electron-api" },
{ { "path": "../../common/env" },
"path": "../../frontend/graphql" { "path": "../graphql" },
}, { "path": "../i18n" },
{ { "path": "../track" },
"path": "../../frontend/i18n" { "path": "../../../blocksuite/affine/all" }
},
{
"path": "../../frontend/electron-api"
},
{
"path": "../../common/debug"
},
{
"path": "../../common/env"
},
{
"path": "../../../blocksuite/affine/all"
}
] ]
} }

View File

@ -10,5 +10,8 @@
}, },
"dependencies": { "dependencies": {
"async-call-rpc": "^6.4.2" "async-call-rpc": "^6.4.2"
},
"devDependencies": {
"@affine/electron": "workspace:*"
} }
} }

View File

@ -6,7 +6,7 @@ import type {
events as mainEvents, events as mainEvents,
handlers as mainHandlers, handlers as mainHandlers,
} from '@affine/electron/main/exposed'; } from '@affine/electron/main/exposed';
import type { appInfo as exposedAppInfo } from '@affine/electron/preload/electron-api'; import type { AppInfo } from '@affine/electron/preload/electron-api';
import type { SharedStorage } from '@affine/electron/preload/shared-storage'; import type { SharedStorage } from '@affine/electron/preload/shared-storage';
type MainHandlers = typeof mainHandlers; type MainHandlers = typeof mainHandlers;
@ -29,9 +29,7 @@ export type ClientHandler = {
} & HelperHandlers; } & HelperHandlers;
export type ClientEvents = MainEvents & HelperEvents; export type ClientEvents = MainEvents & HelperEvents;
export const appInfo = (globalThis as any).__appInfo as export const appInfo = (globalThis as any).__appInfo as AppInfo | null;
| typeof exposedAppInfo
| null;
export const apis = (globalThis as any).__apis as ClientHandler | undefined; export const apis = (globalThis as any).__apis as ClientHandler | undefined;
export const events = (globalThis as any).__events as ClientEvents | undefined; export const events = (globalThis as any).__events as ClientEvents | undefined;
@ -39,7 +37,7 @@ export const sharedStorage = (globalThis as any).__sharedStorage as
| SharedStorage | SharedStorage
| undefined; | undefined;
export type { SharedStorage }; export type { AppInfo, SharedStorage };
export { export {
type SpellCheckStateSchema, type SpellCheckStateSchema,
@ -49,3 +47,7 @@ export {
type WorkbenchViewModule, type WorkbenchViewModule,
} from '@affine/electron/main/shared-state-schema'; } from '@affine/electron/main/shared-state-schema';
export type { UpdateMeta } from '@affine/electron/main/updater/event'; export type { UpdateMeta } from '@affine/electron/main/updater/event';
export type {
AddTabOption,
TabAction,
} from '@affine/electron/main/windows-manager';

View File

@ -1,17 +1,10 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.web.json",
"include": ["./src"], "include": ["./src"],
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": "./src",
"noEmit": false, "outDir": "./dist",
"outDir": "lib" "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"references": [ "references": [{ "path": "../apps/electron" }]
{
"path": "../../common/infra"
},
{
"path": "../../frontend/apps/electron"
}
]
} }

View File

@ -1,14 +1,10 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.web.json",
"include": ["./src"], "include": ["./src"],
"compilerOptions": { "compilerOptions": {
"composite": true, "rootDir": "./src",
"noEmit": false, "outDir": "./dist",
"outDir": "lib" "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"references": [ "references": [{ "path": "../../common/env" }]
{
"path": "../../common/env"
}
]
} }

View File

@ -1,18 +1,14 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.web.json",
"include": ["./src"], "include": [
"exclude": ["./src/resources", "./src/scripts"], "./src",
"./src/resources/*.json",
"./src/i18n-completenesses.json"
],
"compilerOptions": { "compilerOptions": {
"noEmit": false, "rootDir": "./src",
"composite": true, "outDir": "./dist",
"outDir": "lib" "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"references": [ "references": [{ "path": "../../common/debug" }]
{
"path": "./tsconfig.resources.json"
},
{
"path": "../../common/debug/tsconfig.json"
}
]
} }

View File

@ -1,13 +0,0 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"composite": true,
"module": "NodeNext",
"resolveJsonModule": true,
"moduleResolution": "nodenext",
"outDir": "lib/resources",
"noEmit": false
},
"include": ["./src/resources/**/*.ts", "./src/**/*.json"],
"exclude": ["dist", "lib"]
}

View File

@ -1,14 +1,8 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.node.json",
"compilerOptions": { "compilerOptions": {
"noEmit": false, "outDir": "./dist"
"outDir": "lib",
"composite": true,
"types": ["node"]
}, },
"include": ["index.d.ts", "__tests__/**/*.mts"], "include": ["index.d.ts"],
"ts-node": { "references": []
"esm": true,
"experimentalSpecifierResolution": "node"
}
} }

View File

@ -1,4 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { DebugLogger } from '@affine/debug'; import { DebugLogger } from '@affine/debug';
import type { OverridedMixpanel } from 'mixpanel-browser'; import type { OverridedMixpanel } from 'mixpanel-browser';
import mixpanelBrowser from 'mixpanel-browser'; import mixpanelBrowser from 'mixpanel-browser';

View File

@ -1,15 +1,10 @@
{ {
"extends": "../../../tsconfig.json", "extends": "../../../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"outDir": "lib", "rootDir": "./src",
"typeRoots": ["../../../node_modules", "../../../node_modules/@types"], "outDir": "./dist",
"types": ["affine__env"] "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.json"], "include": ["./src"],
"exclude": ["node_modules"], "references": [{ "path": "../../common/debug" }]
"references": [
{
"path": "../../common/debug"
}
]
} }

View File

@ -1,6 +1,7 @@
{ {
"name": "@affine-test/affine-cloud-copilot", "name": "@affine-test/affine-cloud-copilot",
"private": true, "private": true,
"type": "module",
"scripts": { "scripts": {
"e2e": "yarn playwright test" "e2e": "yarn playwright test"
}, },

View File

@ -1,13 +1,10 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"esModuleInterop": true, "rootDir": "./e2e",
"outDir": "lib" "outDir": "./dist",
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["e2e"], "include": ["e2e"],
"references": [ "references": [{ "path": "../kit" }]
{
"path": "../../tests/kit"
}
]
} }

View File

@ -1,6 +1,4 @@
import { resolve } from 'node:path'; import { Path, skipOnboarding, test } from '@affine-test/kit/playwright';
import { skipOnboarding, test } from '@affine-test/kit/playwright';
import { import {
addUserToWorkspace, addUserToWorkspace,
createRandomUser, createRandomUser,
@ -172,7 +170,7 @@ test('can sync svg between different browsers', async ({ page, browser }) => {
const fileChooserPromise = page.waitForEvent('filechooser'); const fileChooserPromise = page.waitForEvent('filechooser');
await page.keyboard.press('Enter', { delay: 50 }); await page.keyboard.press('Enter', { delay: 50 });
const fileChooser = await fileChooserPromise; const fileChooser = await fileChooserPromise;
fileChooser.setFiles(resolve(__dirname, 'logo.svg')); fileChooser.setFiles(Path.dir(import.meta.url).join('logo.svg').value);
await expect(image).toBeVisible(); await expect(image).toBeVisible();
// the user should see the svg // the user should see the svg

View File

@ -1,7 +1,6 @@
import { readFile } from 'node:fs/promises'; import { readFile } from 'node:fs/promises';
import { resolve } from 'node:path';
import { test } from '@affine-test/kit/playwright'; import { Path, test } from '@affine-test/kit/playwright';
import { import {
createRandomUser, createRandomUser,
deleteUser, deleteUser,
@ -72,7 +71,10 @@ test.skip('migration', async ({ page, browser }) => {
await runPrisma(async client => { await runPrisma(async client => {
const sqls = ( const sqls = (
await readFile( await readFile(
resolve(__dirname, 'fixtures', '0.9.0-canary.9-snapshots.sql'), Path.dir(import.meta.url).join(
'fixtures',
'0.9.0-canary.9-snapshots.sql'
).value,
'utf-8' 'utf-8'
) )
) )

View File

@ -1,6 +1,7 @@
{ {
"name": "@affine-test/affine-cloud", "name": "@affine-test/affine-cloud",
"private": true, "private": true,
"type": "module",
"scripts": { "scripts": {
"e2e": "yarn playwright test" "e2e": "yarn playwright test"
}, },

View File

@ -1,13 +1,10 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"esModuleInterop": true, "rootDir": "./e2e",
"outDir": "lib" "outDir": "./dist",
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["e2e"], "include": ["e2e"],
"references": [ "references": [{ "path": "../kit" }]
{
"path": "../../tests/kit"
}
]
} }

View File

@ -1,6 +1,7 @@
{ {
"name": "@affine-test/affine-desktop-cloud", "name": "@affine-test/affine-desktop-cloud",
"private": true, "private": true,
"type": "module",
"scripts": { "scripts": {
"e2e": "yarn playwright test" "e2e": "yarn playwright test"
}, },

View File

@ -1,13 +1,10 @@
{ {
"extends": "../../tsconfig.json", "extends": "../../tsconfig.web.json",
"compilerOptions": { "compilerOptions": {
"esModuleInterop": true, "rootDir": "./e2e",
"outDir": "lib" "outDir": "./dist",
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
}, },
"include": ["e2e"], "include": ["e2e"],
"references": [ "references": [{ "path": "../kit" }]
{
"path": "../../tests/kit"
}
]
} }

View File

@ -1,6 +1,7 @@
{ {
"name": "@affine-test/affine-desktop", "name": "@affine-test/affine-desktop",
"private": true, "private": true,
"type": "module",
"scripts": { "scripts": {
"e2e": "DEBUG=pw:browser yarn playwright test" "e2e": "DEBUG=pw:browser yarn playwright test"
}, },

View File

@ -41,7 +41,7 @@ if (process.env.DEV_SERVER_URL) {
); );
config.webServer = [ config.webServer = [
{ {
command: 'yarn run -T affine bundle -p @affine/electron --dev', command: 'yarn run -T affine bundle -p @affine/electron-renderer --dev',
port: 8080, port: 8080,
timeout: 120 * 1000, timeout: 120 * 1000,
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,

Some files were not shown because too many files have changed in this diff Show More