Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

引入 @vue/tsconfig,并让 tsconfig 继承 #3957

Open
wants to merge 5 commits into
base: preview-features
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
'import/no-default-export': 'error',
'import/no-named-default': 'off',

'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/dev-server/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFileSync, existsSync } from 'fs'
import { existsSync, readFileSync } from 'fs'

interface DevServerConfig {
port?: number
Expand Down
5 changes: 3 additions & 2 deletions dev-tools/dev-server/core-watcher.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import webpack from 'webpack'
import exitHook from 'async-exit-hook'
import webpack from 'webpack'

import webpackConfig from '../../webpack/webpack.dev'
import { sendMessage } from './web-socket-server'
import { defaultWatcherHandler } from './watcher-common'
import { sendMessage } from './web-socket-server'

export const startCoreWatcher = () =>
new Promise<void>(resolve => {
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/dev-server/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { startDevServer } from './server'
import { startCoreWatcher } from './core-watcher'
import { startDevServer } from './server'
import { startWebSocketServer } from './web-socket-server'

startDevServer().then(server => {
Expand Down
6 changes: 4 additions & 2 deletions dev-tools/dev-server/registry-watcher.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Watching, Configuration, webpack } from 'webpack'
import exitHook from 'async-exit-hook'
import type { Configuration, Watching } from 'webpack'
import { webpack } from 'webpack'

import { fromId } from '../../registry/lib/id'
import { devServerConfig } from './config'
import { defaultWatcherHandler } from './watcher-common'
import { sendMessage } from './web-socket-server'
import { devServerConfig } from './config'

export const watchers: { url: string; instance: Watching }[] = []
export const parseRegistryUrl = (url: string) => {
Expand Down
10 changes: 6 additions & 4 deletions dev-tools/dev-server/server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { createServer, Server } from 'http'
import { Configuration } from 'webpack'
import exitHook from 'async-exit-hook'
import type { Server } from 'http'
import { createServer } from 'http'
import handler from 'serve-handler'
import { devServerConfig } from './config'
import type { Configuration } from 'webpack'

import { buildByEntry } from '../../registry/webpack/config'
import { devServerConfig } from './config'
import { parseRegistryUrl, startRegistryWatcher, watchers } from './registry-watcher'
import { exitWebSocketServer } from './web-socket-server'
import { watchers, parseRegistryUrl, startRegistryWatcher } from './registry-watcher'

export const startDevServer = () =>
new Promise<Server>(resolve => {
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/dev-server/watcher-common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Stats } from 'webpack'
import type { Stats } from 'webpack'

export const defaultWatcherHandler = (
initCallback: (result: Stats) => void,
Expand Down
5 changes: 3 additions & 2 deletions dev-tools/dev-server/web-socket-server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import exitHook from 'async-exit-hook'
import { Server } from 'http'
import type { Server } from 'http'
import { WebSocketServer } from 'ws'
import { Payload } from './payload'

import type { Payload } from './payload'
import { stopInstance, watchers } from './registry-watcher'

let server: WebSocketServer
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
"@types/serve-handler": "^6.1.1",
"@types/sortablejs": "^1.10.7",
"@types/streamsaver": "^2.0.1",
"@types/webpack-env": "^1.15.1",
"@types/webpack-env": "^1.16.4",
"@types/ws": "^8.2.3",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"@vue/tsconfig": "^0.1.3",
"async-exit-hook": "^2.0.1",
"autoprefixer": "^10.0.1",
"babel-loader": "^8.1.0",
Expand Down
7,225 changes: 2,837 additions & 4,388 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion registry/lib/components/feeds/copy-link/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineComponentMetadata } from '@/components/define'
import { FeedsCard } from '@/components/feeds/api'
import type { FeedsCard } from '@/components/feeds/api'
import { feedsUrls } from '@/core/utils/urls'

const entry = async () => {
Expand Down
3 changes: 2 additions & 1 deletion registry/lib/components/feeds/disable-details/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineComponentMetadata } from '@/components/define'
import { FeedsCard, feedsCardTypes } from '@/components/feeds/api'
import type { FeedsCard } from '@/components/feeds/api'
import { feedsCardTypes } from '@/components/feeds/api'
import { feedsUrls } from '@/core/utils/urls'

let enabled = true
Expand Down
16 changes: 9 additions & 7 deletions registry/lib/components/feeds/filter/FeedsFilterCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,20 @@
</template>

<script lang="ts">
import {
import type {
feedsCardsManager,
FeedsCard,
FeedsCardType,
feedsCardTypes,
forEachFeedsCard,
RepostFeedsCard,
} from '@/components/feeds/api'

import { feedsCardTypes, forEachFeedsCard } from '@/components/feeds/api'
import { attributes } from '@/core/observer'
import { getComponentSettings } from '@/core/settings'
import { select } from '@/core/spin-query'
import { attributes } from '@/core/observer'
import { VIcon, TextBox, VButton } from '@/ui'
import { FeedsFilterOptions } from '.'
import { TextBox, VButton, VIcon } from '@/ui'

import type { FeedsFilterOptions } from '.'
import { hasBlockedPattern } from './pattern'

const options = getComponentSettings('feedsFilter').options as FeedsFilterOptions
Expand Down Expand Up @@ -99,7 +101,7 @@ const sideCards: { [id: number]: SideCardType } = {
displayName: '发布动态',
},
}
let cardsManager: typeof import('@/components/feeds/api').feedsCardsManager
let cardsManager: typeof feedsCardsManager
const sideBlock = 'feeds-filter-side-block-'

export default Vue.extend({
Expand Down
8 changes: 3 additions & 5 deletions registry/lib/components/feeds/filter/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
defineOptionsMetadata,
defineComponentMetadata,
OptionsOfMetadata,
} from '@/components/define'
import type { OptionsOfMetadata } from '@/components/define'
import { defineComponentMetadata, defineOptionsMetadata } from '@/components/define'
import { feedsCardsManager } from '@/components/feeds/api'

import { feedsFilterPlugin } from './plugin'

const entry = async () => {
Expand Down
8 changes: 5 additions & 3 deletions registry/lib/components/feeds/filter/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { FeedsContentFilter } from '@/components/feeds/api'
import type { FeedsContentFilter } from '@/components/feeds/api'
import { getComponentSettings } from '@/core/settings'
import { PluginMetadata } from '@/plugins/plugin'
import { BlockableCard, hasBlockedPattern } from './pattern'
import type { PluginMetadata } from '@/plugins/plugin'

import type { BlockableCard } from './pattern'
import { hasBlockedPattern } from './pattern'

const bangumiFields = {
username: 'title',
Expand Down
6 changes: 3 additions & 3 deletions registry/lib/components/feeds/fold-comments/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { defineComponentMetadata } from '@/components/define'
import { styledComponentEntry } from '@/components/styled-component'
import { feedsUrlsWithoutDetail } from '@/core/utils/urls'
import { feedsCardsManager } from '@/components/feeds/api'
import { select } from '@/core/spin-query'
import { styledComponentEntry } from '@/components/styled-component'
import { childListSubtree } from '@/core/observer'
import { select } from '@/core/spin-query'
import { feedsUrlsWithoutDetail } from '@/core/utils/urls'

const entry = async () => {
const { forEachFeedsCard } = await import('@/components/feeds/api')
Expand Down
4 changes: 3 additions & 1 deletion registry/lib/components/live/badge-helper/BadgeHelper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
import { addComponentListener, getComponentSettings } from '@/core/settings'
import { descendingSort } from '@/core/utils/sort'
import { DefaultWidget, VPopup } from '@/ui'
import { Medal, Title, Badge, getMedalList, getTitleList } from './badge'

import type { Badge } from './badge'
import { getMedalList, getTitleList, Medal, Title } from './badge'

const { options } = getComponentSettings('badgeHelper')
export default Vue.extend({
Expand Down
1 change: 1 addition & 0 deletions registry/lib/components/live/badge-helper/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineComponentMetadata } from '@/components/define'
import { getNumberValidator, getUID, none } from '@/core/utils'

import { autoMatchMedal } from './auto-match'

export const component = defineComponentMetadata({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script lang="ts">
import { select } from '@/core/spin-query'
import { raiseEvent } from '@/core/utils'

import { originalTextAreaSelector, sendButtonSelector } from './original-elements'

let changeEventHook = false
Expand Down
3 changes: 2 additions & 1 deletion registry/lib/components/live/danmaku-sendbar/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { waitForControlBar } from '@/components/live/live-control-bar'
import { defineComponentMetadata } from '@/components/define'
import { waitForControlBar } from '@/components/live/live-control-bar'
import { getUID } from '@/core/utils'
import { liveUrls } from '@/core/utils/urls'

import { leftControllerSelector } from './original-elements'

const entry = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
</template>

<script lang="ts">
import { DefaultWidget } from '@/ui'
import { getJson } from '@/core/ajax'
import { Toast } from '@/core/toast'
import { logError } from '@/core/utils/log'
import { DefaultWidget } from '@/ui'

export default Vue.extend({
components: {
Expand Down
3 changes: 2 additions & 1 deletion registry/lib/components/live/gift-box/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { waitForControlBar } from '@/components/live/live-control-bar'
import { defineComponentMetadata } from '@/components/define'
import { waitForControlBar } from '@/components/live/live-control-bar'
import { select as spinSelect } from '@/core/spin-query'
import { addStyle, removeStyle } from '@/core/style'
import { liveUrls } from '@/core/utils/urls'

import componentStyle from './gift-box.scss'

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { toggleStyle } from '@/components/styled-component'
import { defineComponentMetadata } from '@/components/define'
import { toggleStyle } from '@/components/styled-component'

export const component = defineComponentMetadata({
...toggleStyle('alwaysShowDuration', () => import('./always-show-duration.scss')),
Expand Down
3 changes: 2 additions & 1 deletion registry/lib/components/style/custom-navbar/CustomNavbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import { addComponentListener } from '@/core/settings'
import { getUID } from '@/core/utils'
import { ascendingSort } from '@/core/utils/sort'
import { registerAndGetData } from '@/plugins/data'

import { getBuiltInItems } from './built-in-items'
import type { CustomNavbarItemInit } from './custom-navbar-item'
import {
CustomNavbarItemInit,
CustomNavbarItem,
CustomNavbarItems,
CustomNavbarRenderedItems,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@

<script lang="ts">
import { addComponentListener, removeComponentListener } from '@/core/settings'
import CustomNavbarLink from './CustomNavbarLink.vue'

import { CustomNavbarItem } from './custom-navbar-item'
import CustomNavbarLink from './CustomNavbarLink.vue'

const isOpenInNewTab = (item: CustomNavbarItem) => {
const { name } = item
Expand Down
22 changes: 11 additions & 11 deletions registry/lib/components/style/custom-navbar/built-in-items.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { CustomNavbarItemInit } from './custom-navbar-item'
import { messages } from './messages/messages'
import { ranking } from './ranking/ranking'
import { userInfo } from './user-info/user-info'
import { logo } from './logo/logo'
import type { CustomNavbarItemInit } from './custom-navbar-item'
import { favorites } from './favorites/favorites'
import { feeds } from './feeds/feeds'
import { blanks } from './flexible-blank/flexible-blank'
import { history } from './history/history'
import { home } from './home/home'
import { gamesIframe, livesIframe, mangaIframe } from './iframe/iframe'
import { blanks } from './flexible-blank/flexible-blank'
import { bangumi, music, drawing, shop, match } from './simple-links/simple-links'
import { upload } from './upload/upload'
import { logo } from './logo/logo'
import { messages } from './messages/messages'
import { ranking } from './ranking/ranking'
import { search } from './search/search'
import { feeds } from './feeds/feeds'
import { bangumi, drawing, match, music, shop } from './simple-links/simple-links'
import { subscriptions } from './subscriptions/subscriptions'
import { upload } from './upload/upload'
import { userInfo } from './user-info/user-info'
import { watchlater } from './watchlater/watchlater'
import { favorites } from './favorites/favorites'
import { history } from './history/history'

const [blank1, blank2, blank3, blank4] = blanks
export const getBuiltInItems = (): CustomNavbarItemInit[] => [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { createPopper, Instance as Popper } from '@popperjs/core'
import { VueModule, Executable } from '@/core/common-types'
import { getComponentSettings, addComponentListener } from '@/core/settings'
import type { Instance as Popper } from '@popperjs/core'
import { createPopper } from '@popperjs/core'

import type { Executable, VueModule } from '@/core/common-types'
import { addComponentListener, getComponentSettings } from '@/core/settings'

import type { CustomNavbarOptions } from '.'

export const CustomNavbarItems = 'customNavbar.items'
Expand Down
2 changes: 1 addition & 1 deletion registry/lib/components/style/custom-navbar/entry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentEntry } from '@/components/types'
import type { ComponentEntry } from '@/components/types'
import { addComponentListener } from '@/core/settings'
import { isIframe, isNotHtml, matchUrlPattern, mountVueComponent } from '@/core/utils'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
</VDropdown>
</template>
<script lang="ts">
import { VDropdown } from '@/ui'
import { getUID } from '@/core/utils'
import { getJsonWithCredentials } from '@/core/ajax'
import { getComponentSettings } from '@/core/settings'
import { FavoritesFolder, notSelectedFolder } from './favorites-folder'
import { getUID } from '@/core/utils'
import { VDropdown } from '@/ui'

import type { FavoritesFolder } from './favorites-folder'
import { notSelectedFolder } from './favorites-folder'

const navbarOptions = getComponentSettings('customNavbar').options
export default Vue.extend({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,17 @@
</div>
</template>
<script lang="ts">
import { VLoading, VEmpty, VIcon, VButton, TextBox, DpiImage, ScrollTrigger } from '@/ui'
import { formatDate, formatDuration } from '@/core/utils/formatters'
import { getUID } from '@/core/utils'
import type { VideoCard } from '@/components/feeds/video-card'
import { getJsonWithCredentials } from '@/core/ajax'
import { logError } from '@/core/utils/log'
import { VideoCard } from '@/components/feeds/video-card'
import { getComponentSettings } from '@/core/settings'
import { getUID } from '@/core/utils'
import { formatDate, formatDuration } from '@/core/utils/formatters'
import { logError } from '@/core/utils/log'
import { DpiImage, ScrollTrigger, TextBox, VButton, VEmpty, VIcon, VLoading } from '@/ui'

import { popperMixin } from '../mixins'
import { notSelectedFolder } from './favorites-folder'
import FavoritesFolderSelect from './FavoritesFolderSelect.vue'
import { popperMixin } from '../mixins'

/*
新版收藏夹 API
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { getUID } from '@/core/utils'
import { CustomNavbarItemInit } from '../custom-navbar-item'

import type { CustomNavbarItemInit } from '../custom-navbar-item'

const href = `https://space.bilibili.com/${getUID()}/favlist`
export const favorites: CustomNavbarItemInit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
</div>
</template>
<script lang="ts">
import { TabControl, VIcon } from '@/ui'
import { feedsCardTypes } from '@/components/feeds/api'
import { getNotifyCount } from '@/components/feeds/notify'
import { TabControl, VIcon } from '@/ui'

import { popperMixin } from '../mixins'
import { tabs } from './tabs/tabs'

Expand Down
2 changes: 1 addition & 1 deletion registry/lib/components/style/custom-navbar/feeds/feeds.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CustomNavbarItemInit } from '../custom-navbar-item'
import type { CustomNavbarItemInit } from '../custom-navbar-item'

export const feeds: CustomNavbarItemInit = {
name: 'feeds',
Expand Down
Loading