chore(svelte): Cleanup dependencies (#63691)

We have introduced a dependency on wildcard again, which should not be
an issue in production but will slow down the initial page load during
dev builds.

I also took the time clean up other transitive depdencies on modules
using React (based on file extension). Turns out that some tsx files
should actually be ts files because they don't use React.

## Test plan

The build system should catch any issues with moved exports.
This commit is contained in:
Felix Kling 2024-07-08 17:54:44 +02:00 committed by GitHub
parent a6d53b5305
commit aa0be2e68e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 73 additions and 77 deletions

View File

@ -278,6 +278,7 @@ ts_project(
"src/search/searchQueryState.tsx",
"src/search/stream.ts",
"src/search/suggestions/index.ts",
"src/search/types.ts",
"src/settings/edit.ts",
"src/settings/settings.tsx",
"src/settings/temporary/TemporarySettings.ts",

View File

@ -6,7 +6,7 @@ import type { SearchPatternType } from '../graphql-operations'
import type { SearchContextProps } from './helpers/searchContext'
import type { CharacterRange } from './query/token'
import type { SearchMode } from './searchQueryState'
import type { SearchMode } from './types'
export interface SearchPatternTypeProps {
patternType: SearchPatternType

View File

@ -3,3 +3,4 @@ export * from './searchQueryState'
export * from './helpers'
export * from './helpers/queryExample'
export * from './helpers/searchContext'
export * from './types'

View File

@ -9,6 +9,7 @@ import { type QueryState, type SubmitSearchParameters, toggleSubquery } from './
import type { FilterType } from './query/filters'
import { appendFilter, updateFilter } from './query/transformer'
import { filterExists } from './query/validate'
import { SearchMode } from './types'
export type SearchQueryStateStore<T extends SearchQueryState = SearchQueryState> = UseBoundStore<T, StoreApi<T>>
@ -43,11 +44,6 @@ export enum InitialParametersSource {
URL,
}
export enum SearchMode {
Precise = 0,
SmartSearch = 1 << 0,
}
// Implemented in /web as navbar query state, /vscode as webview query state.
export interface SearchQueryState {
/**

View File

@ -14,7 +14,7 @@ import { asError, type ErrorLike, isErrorLike } from '@sourcegraph/common'
import type { SearchPatternType, SymbolKind } from '../graphql-operations'
import { SearchMode } from './searchQueryState'
import { SearchMode } from './types'
// The latest supported version of our search syntax. Users should never be able to determine the search version.
// The version is set based on the release tag of the instance.

View File

@ -0,0 +1,4 @@
export enum SearchMode {
Precise = 0,
SmartSearch = 1 << 0,
}

View File

@ -8,7 +8,7 @@ import type { SearchPatternType } from '../graphql-operations'
import { discreteValueAliases } from '../search/query/filters'
import { findFilter, FilterKind } from '../search/query/query'
import { appendContextFilter, omitFilter } from '../search/query/transformer'
import { SearchMode } from '../search/searchQueryState'
import { SearchMode } from '../search/types'
export interface RepoSpec {
/**

View File

@ -72,7 +72,7 @@
"unplugin-auto-import": "^0.17.6",
"unplugin-icons": "^0.19.0",
"vite": "~5.1.5",
"vite-plugin-inspect": "^0.7.35",
"vite-plugin-inspect": "^0.8.4",
"vitest": "^1.3.1"
},
"type": "module",

View File

@ -60,7 +60,6 @@ export {
rankByLine,
truncateGroups,
} from '@sourcegraph/shared/src/components/ranking/PerFileResultRanking'
export { TELEMETRY_SEARCH_SOURCE_TYPE } from '@sourcegraph/shared/src/search'
export { filterExists } from '@sourcegraph/shared/src/search/query/validate'
export {
getRelevantTokens,
@ -74,13 +73,16 @@ export { FilterType } from '@sourcegraph/shared/src/search/query/filters'
export { getGlobalSearchContextFilter, findFilter, FilterKind } from '@sourcegraph/shared/src/search/query/query'
export { isFilterOfType } from '@sourcegraph/shared/src/search/query/utils'
export { omitFilter, appendFilter, updateFilter } from '@sourcegraph/shared/src/search/query/transformer'
export { type Settings, SettingsProvider } from '@sourcegraph/shared/src/settings/settings'
export type { Settings } from '@sourcegraph/shared/src/settings/settings'
export { fetchStreamSuggestions } from '@sourcegraph/shared/src/search/suggestions'
export { QueryChangeSource, type QueryState } from '@sourcegraph/shared/src/search/helpers'
export {
QueryChangeSource,
type QueryState,
TELEMETRY_SEARCH_SOURCE_TYPE,
} from '@sourcegraph/shared/src/search/helpers'
export { migrateLocalStorageToTemporarySettings } from '@sourcegraph/shared/src/settings/temporary/migrateLocalStorageToTemporarySettings'
export type { TemporarySettings } from '@sourcegraph/shared/src/settings/temporary/TemporarySettings'
export { SyntaxKind, Occurrence } from '@sourcegraph/shared/src/codeintel/scip'
export { shortcutDisplayName } from '@sourcegraph/shared/src/keyboardShortcuts'
export { createCodeIntelAPI, type CodeIntelAPI } from '@sourcegraph/shared/src/codeintel/api'
export { getModeFromPath } from '@sourcegraph/shared/src/languages'
export type { ActionItemAction } from '@sourcegraph/shared/src/actions/ActionItem'

View File

@ -2,8 +2,6 @@
import type { ComponentProps } from 'svelte'
import { writable } from 'svelte/store'
import { getButtonClassName } from '@sourcegraph/wildcard'
import { goto } from '$app/navigation'
import { page } from '$app/stores'
import { sizeToFit } from '$lib/dom'
@ -18,6 +16,7 @@
import { default as TabsHeader } from '$lib/TabsHeader.svelte'
import { TELEMETRY_RECORDER } from '$lib/telemetry'
import { DropdownMenu, MenuLink } from '$lib/wildcard'
import { getButtonClassName } from '$lib/wildcard/Button'
import type { LayoutData } from './$types'
import { setRepositoryPageContext, type RepositoryPageContext } from './context'

View File

@ -1280,7 +1280,7 @@ ts_project(
"src/repo/blob/actions/ToggleRenderedFileMode.tsx",
"src/repo/blob/actions/utils.ts",
"src/repo/blob/backend.ts",
"src/repo/blob/blameRecency.tsx",
"src/repo/blob/blameRecency.ts",
"src/repo/blob/codemirror/blame-decorations.ts",
"src/repo/blob/codemirror/code-folding.tsx",
"src/repo/blob/codemirror/codeintel/api.ts",
@ -1314,7 +1314,7 @@ ts_project(
"src/repo/blob/codemirror/tooltips/CodyTooltip.tsx",
"src/repo/blob/codemirror/tooltips/HovercardView.tsx",
"src/repo/blob/codemirror/tooltips/LoadingTooltip.ts",
"src/repo/blob/codemirror/tooltips/TemporaryTooltip.tsx",
"src/repo/blob/codemirror/tooltips/TemporaryTooltip.ts",
"src/repo/blob/codemirror/types.ts",
"src/repo/blob/codemirror/utils.ts",
"src/repo/blob/definitions.ts",

View File

@ -5,11 +5,11 @@ import { startWith, switchMap, map, distinctUntilChanged } from 'rxjs/operators'
import { memoizeObservable } from '@sourcegraph/common'
import { SearchPatternType } from '@sourcegraph/shared/src/graphql-operations'
import { SearchMode } from '@sourcegraph/shared/src/search'
import { discreteValueAliases, escapeSpaces } from '@sourcegraph/shared/src/search/query/filters'
import { findFilter, FilterKind, getGlobalSearchContextFilter } from '@sourcegraph/shared/src/search/query/query'
import { omitFilter } from '@sourcegraph/shared/src/search/query/transformer'
import type { AggregateStreamingSearchResults, StreamSearchOptions } from '@sourcegraph/shared/src/search/stream'
import { SearchMode } from '@sourcegraph/shared/src/search/types'
export type { SearchAggregationProps } from './results/sidebar/search-aggregation-types'

View File

@ -16,7 +16,7 @@ import {
} from '@sourcegraph/branded/src/search-ui/experimental'
import { getQueryInformation } from '@sourcegraph/branded/src/search-ui/input/codemirror/parsedQuery'
import { gql } from '@sourcegraph/http-client'
import { getUserSearchContextNamespaces } from '@sourcegraph/shared/src/search'
import { getUserSearchContextNamespaces } from '@sourcegraph/shared/src/search/backend'
import { getRelevantTokens } from '@sourcegraph/shared/src/search/query/analyze'
import { regexInsertText } from '@sourcegraph/shared/src/search/query/completion-utils'
import {

View File

@ -2,7 +2,7 @@ import { startCase } from 'lodash'
import { isErrorLike } from '@sourcegraph/common'
import { SearchPatternType } from '@sourcegraph/shared/src/graphql-operations'
import { SearchMode } from '@sourcegraph/shared/src/search'
import { SearchMode } from '@sourcegraph/shared/src/search/types'
import type { SettingsCascadeOrError, SettingsSubjectCommonFields } from '@sourcegraph/shared/src/settings/settings'
import type { AuthenticatedUser } from '../auth'

View File

@ -1769,8 +1769,8 @@ importers:
specifier: ~5.1.5
version: 5.1.5(@types/node@20.8.0)(sass@1.32.4)
vite-plugin-inspect:
specifier: ^0.7.35
version: 0.7.35(vite@5.1.5)
specifier: ^0.8.4
version: 0.8.4(vite@5.1.5)
vitest:
specifier: ^1.3.1
version: 1.3.1(@types/node@20.8.0)(happy-dom@12.10.1)(jsdom@24.0.0)(sass@1.32.4)
@ -13894,11 +13894,11 @@ packages:
resolution: {integrity: sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==}
dev: false
/bundle-name@3.0.0:
resolution: {integrity: sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==}
engines: {node: '>=12'}
/bundle-name@4.1.0:
resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==}
engines: {node: '>=18'}
dependencies:
run-applescript: 5.0.0
run-applescript: 7.0.0
dev: true
/bundlesize2@0.0.31:
@ -15603,14 +15603,17 @@ packages:
untildify: 4.0.0
dev: true
/default-browser@4.0.0:
resolution: {integrity: sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==}
engines: {node: '>=14.16'}
/default-browser-id@5.0.0:
resolution: {integrity: sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==}
engines: {node: '>=18'}
dev: true
/default-browser@5.2.1:
resolution: {integrity: sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==}
engines: {node: '>=18'}
dependencies:
bundle-name: 3.0.0
default-browser-id: 3.0.0
execa: 7.2.0
titleize: 3.0.0
bundle-name: 4.1.0
default-browser-id: 5.0.0
dev: true
/defaults@1.0.3:
@ -16085,6 +16088,10 @@ packages:
dependencies:
is-arrayish: 0.2.1
/error-stack-parser-es@0.1.4:
resolution: {integrity: sha512-l0uy0kAoo6toCgVOYaAayqtPa2a1L15efxUMEnQebKwLQX2X0OpS6wMMQdc4juJXmxd9i40DuaUHq+mjIya9TQ==}
dev: true
/error-stack-parser@2.1.4:
resolution: {integrity: sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==}
dependencies:
@ -17015,21 +17022,6 @@ packages:
signal-exit: 3.0.7
strip-final-newline: 2.0.0
/execa@7.2.0:
resolution: {integrity: sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==}
engines: {node: ^14.18.0 || ^16.14.0 || >=18.0.0}
dependencies:
cross-spawn: 7.0.3
get-stream: 6.0.1
human-signals: 4.3.1
is-stream: 3.0.0
merge-stream: 2.0.0
npm-run-path: 5.1.0
onetime: 6.0.0
signal-exit: 3.0.7
strip-final-newline: 3.0.0
dev: true
/execa@8.0.1:
resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==}
engines: {node: '>=16.17'}
@ -18664,11 +18656,6 @@ packages:
resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
engines: {node: '>=10.17.0'}
/human-signals@4.3.1:
resolution: {integrity: sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==}
engines: {node: '>=14.18.0'}
dev: true
/human-signals@5.0.0:
resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==}
engines: {node: '>=16.17.0'}
@ -19275,6 +19262,13 @@ packages:
dependencies:
is-docker: 2.2.1
/is-wsl@3.1.0:
resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==}
engines: {node: '>=16'}
dependencies:
is-inside-container: 1.0.0
dev: true
/isarray@0.0.1:
resolution: {integrity: sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==}
dev: true
@ -21937,6 +21931,16 @@ packages:
resolution: {integrity: sha512-gSHRpWLx83rKlHZIm9ZoUBsSMijhPRMxOOacUETjY8guu9dAwIAbtZgmVqkfglmhs3/pYppGohzp8fUdJ4YBqQ==}
dev: false
/open@10.1.0:
resolution: {integrity: sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==}
engines: {node: '>=18'}
dependencies:
default-browser: 5.2.1
define-lazy-prop: 3.0.0
is-inside-container: 1.0.0
is-wsl: 3.1.0
dev: true
/open@6.4.0:
resolution: {integrity: sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg==}
engines: {node: '>=8'}
@ -21960,16 +21964,6 @@ packages:
is-wsl: 2.2.0
dev: true
/open@9.1.0:
resolution: {integrity: sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==}
engines: {node: '>=14.16'}
dependencies:
default-browser: 4.0.0
define-lazy-prop: 3.0.0
is-inside-container: 1.0.0
is-wsl: 2.2.0
dev: true
/opentelemetry-instrumentation-fetch-node@1.2.0:
resolution: {integrity: sha512-aiSt/4ubOTyb1N5C2ZbGrBvaJOXIZhZvpRPYuUVxQJe27wJZqf/o65iPrqgLcgfeOLaQ8cS2Q+762jrYvniTrA==}
engines: {node: '>18.0.0'}
@ -22465,6 +22459,10 @@ packages:
resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==}
dev: true
/perfect-debounce@1.0.0:
resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==}
dev: true
/performance-now@2.1.0:
resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==}
dev: false
@ -24355,11 +24353,9 @@ packages:
/rrweb-cssom@0.6.0:
resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==}
/run-applescript@5.0.0:
resolution: {integrity: sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==}
engines: {node: '>=12'}
dependencies:
execa: 5.1.1
/run-applescript@7.0.0:
resolution: {integrity: sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==}
engines: {node: '>=18'}
dev: true
/run-async@2.4.1:
@ -25931,11 +25927,6 @@ packages:
tslib: 2.1.0
dev: true
/titleize@3.0.0:
resolution: {integrity: sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==}
engines: {node: '>=12'}
dev: true
/tmp@0.0.33:
resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==}
engines: {node: '>=0.6.0'}
@ -26889,12 +26880,12 @@ packages:
- sugarss
- terser
/vite-plugin-inspect@0.7.35(vite@5.1.5):
resolution: {integrity: sha512-e5w5dJAj3vDcHTxn8hHbiH+mVqYs17gaW00f3aGuMTXiqUog+T1Lsxr9Jb4WRiip84cpuhR0KFFBT1egtXboiA==}
/vite-plugin-inspect@0.8.4(vite@5.1.5):
resolution: {integrity: sha512-G0N3rjfw+AiiwnGw50KlObIHYWfulVwaCBUBLh2xTW9G1eM9ocE5olXkEYUbwyTmX+azM8duubi+9w5awdCz+g==}
engines: {node: '>=14'}
peerDependencies:
'@nuxt/kit': '*'
vite: ^3.1.0 || ^4.0.0
vite: ^3.1.0 || ^4.0.0 || ^5.0.0-0
peerDependenciesMeta:
'@nuxt/kit':
optional: true
@ -26902,8 +26893,10 @@ packages:
'@antfu/utils': 0.7.8
'@rollup/pluginutils': 5.1.0
debug: 4.3.4
error-stack-parser-es: 0.1.4
fs-extra: 11.2.0
open: 9.1.0
open: 10.1.0
perfect-debounce: 1.0.0
picocolors: 1.0.0
sirv: 2.0.4
vite: 5.1.5(@types/node@20.8.0)(sass@1.32.4)