From 6d816946b0e28c20728ac01dea8dd6a84690bd88 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 25 Nov 2024 19:04:06 -0500 Subject: [PATCH] Refactors --- component_tests/cgv/cypress/e2e/basic.cy.ts | 2 +- packages/core/util/types/index.ts | 16 +- packages/sv-core/package.json | 2 +- .../src/BreakendSingleLevelOptionDialog.tsx | 95 +-------- packages/sv-core/src/util.ts | 183 +++++++++++++++++- ...aunchPairedEndBreakpointSplitViewPanel.tsx | 1 - ...ntaryAlignmentBreakpointSplitViewPanel.tsx | 1 - .../SupplementaryAlignments.tsx | 4 - .../BreakpointSplitView.ts | 2 +- .../components/BookmarkGrid.tsx | 3 +- .../sv-inspector/src/SvInspectorView/index.ts | 58 +++--- .../sv-inspector/src/SvInspectorView/model.ts | 1 + .../LaunchBreakendPanel.tsx | 13 +- .../jbrowse-react-app/src/rootModel/index.ts | 2 +- .../src/tests/BookmarkWidget.test.tsx | 24 --- products/jbrowse-web/src/tests/util.tsx | 3 +- webpack/config/env.js | 1 - webpack/config/getHttpsConfig.js | 1 - webpack/config/webpack.config.js | 1 - webpack/scripts/build.js | 5 +- webpack/scripts/start.js | 1 - 21 files changed, 233 insertions(+), 186 deletions(-) diff --git a/component_tests/cgv/cypress/e2e/basic.cy.ts b/component_tests/cgv/cypress/e2e/basic.cy.ts index 99c9df5c51..f56606973f 100644 --- a/component_tests/cgv/cypress/e2e/basic.cy.ts +++ b/component_tests/cgv/cypress/e2e/basic.cy.ts @@ -2,6 +2,6 @@ describe('JBrowse embedded circular view', () => { it('track loads', () => { cy.visit('/') - cy.findByTestId('chord-1148282975-vcf-63101', { timeout: 30000 }) + cy.findByTestId('chord--2069028604-vcf-62853', { timeout: 30000 }) }) }) diff --git a/packages/core/util/types/index.ts b/packages/core/util/types/index.ts index 227dcd3170..36c3f32210 100644 --- a/packages/core/util/types/index.ts +++ b/packages/core/util/types/index.ts @@ -152,27 +152,25 @@ export function isSessionModel(thing: unknown): thing is AbstractSessionModel { } /** abstract interface for a session allows editing configurations */ -export interface SessionWithConfigEditingModel extends AbstractSessionModel { +export interface SessionWithConfigEditing extends AbstractSessionModel { editConfiguration(configuration: AnyConfigurationModel): void } export function isSessionModelWithConfigEditing( - thing: unknown, -): thing is SessionWithConfigEditingModel { - return isSessionModel(thing) && 'editConfiguration' in thing + t: unknown, +): t is SessionWithConfigEditing { + return isSessionModel(t) && 'editConfiguration' in t } /** abstract interface for a session allows adding tracks */ -export interface SessionWithConfigEditingModel extends AbstractSessionModel { +export interface SessionWithAddTracks extends AbstractSessionModel { addTrackConf( configuration: AnyConfigurationModel | SnapshotIn, ): void } -export function isSessionWithAddTracks( - thing: unknown, -): thing is SessionWithConfigEditingModel { +export function isSessionWithAddTracks(t: unknown): t is SessionWithAddTracks { return ( // @ts-expect-error - isSessionModel(thing) && 'addTrackConf' in thing && !thing.disableAddTracks + isSessionModel(t) && 'addTrackConf' in t && !t.disableAddTracks ) } diff --git a/packages/sv-core/package.json b/packages/sv-core/package.json index 399917d869..07545492da 100644 --- a/packages/sv-core/package.json +++ b/packages/sv-core/package.json @@ -45,7 +45,7 @@ "@jbrowse/core": "^2.17.0", "@mui/icons-material": "^6.0.0", "@mui/material": "^6.0.0", - "@gmod/vcf": "^5.0.0" + "@gmod/vcf": "^5.0.9" }, "peerDependencies": { "mobx": "^6.0.0", diff --git a/packages/sv-core/src/BreakendSingleLevelOptionDialog.tsx b/packages/sv-core/src/BreakendSingleLevelOptionDialog.tsx index 88d020b2f7..608eaf6387 100644 --- a/packages/sv-core/src/BreakendSingleLevelOptionDialog.tsx +++ b/packages/sv-core/src/BreakendSingleLevelOptionDialog.tsx @@ -1,35 +1,17 @@ import React, { useState } from 'react' import { Dialog } from '@jbrowse/core/ui' -import { getSession, useLocalStorage, when } from '@jbrowse/core/util' +import { useLocalStorage } from '@jbrowse/core/util' import { Button, DialogActions, DialogContent, TextField } from '@mui/material' import { observer } from 'mobx-react' -import { getSnapshot } from 'mobx-state-tree' // locals import Checkbox2 from './Checkbox2' // types +import { navToSingleLevelBreak } from './util' import type { AbstractSessionModel, Feature } from '@jbrowse/core/util' import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view' -import { singleLevelSnapshotFromBreakendFeature } from './util' - -interface Display { - id: string - [key: string]: unknown -} -interface Track { - id: string - displays: Display[] - [key: string]: unknown -} - -function stripIds(arr: Track[]) { - return arr.map(({ id, displays, ...rest }) => ({ - ...rest, - displays: displays.map(({ id, ...rest }) => rest), - })) -} const BreakendSingleLevelOptionDialog = observer(function ({ session, @@ -89,73 +71,14 @@ const BreakendSingleLevelOptionDialog = observer(function ({ if (!assembly) { throw new Error(`assembly ${assemblyName} not found`) } - const w = +windowSize - if (Number.isNaN(w)) { - throw new Error('windowSize not a number') - } - const { snap, coverage } = - singleLevelSnapshotFromBreakendFeature({ - feature, - assemblyName, - session, - }) - const { - refName, - pos: startPos, - mateRefName, - matePos: endPos, - } = coverage - let viewInStack = session.views.find( - f => f.id === stableViewId, - ) as { views: LinearGenomeViewModel[] } | undefined - - if (!viewInStack) { - viewInStack = session.addView('BreakpointSplitView', { - ...snap, - views: [ - { - ...snap.views[0], - tracks: view?.tracks - ? stripIds(getSnapshot(view.tracks)) - : [], - }, - ], - }) as unknown as { views: LinearGenomeViewModel[] } - } else { - viewInStack.views[0]?.setDisplayedRegions( - snap.views[0]!.displayedRegions, - ) - // @ts-expect-error - viewInStack.setDisplayName(snap.displayName) - } - const lgv = viewInStack.views[0]! - await when(() => lgv.initialized) - console.log( - 'wtf', - snap, - view?.displayedRegions, - startPos, - endPos, - refName, - mateRefName, - ) - const l0 = lgv.bpToPx({ - coord: Math.max(0, startPos - w), - refName, - }) - const r0 = lgv.bpToPx({ - coord: endPos + w, - refName: mateRefName, + await navToSingleLevelBreak({ + feature, + assemblyName, + session, + stableViewId, + tracks: view?.tracks, + windowSize: +windowSize || 0, }) - console.log({ l0, r0 }) - if (l0 && r0) { - lgv.moveTo( - { ...l0, offset: l0.offsetPx }, - { ...r0, offset: r0.offsetPx }, - ) - } else { - getSession(lgv).notify('Unable to navigate to breakpoint') - } } catch (e) { console.error(e) session.notifyError(`${e}`, e) diff --git a/packages/sv-core/src/util.ts b/packages/sv-core/src/util.ts index 941e1a301e..0a957f4119 100644 --- a/packages/sv-core/src/util.ts +++ b/packages/sv-core/src/util.ts @@ -1,8 +1,29 @@ import { parseBreakend } from '@gmod/vcf' -import { gatherOverlaps } from '@jbrowse/core/util' +import { gatherOverlaps, getSession, when } from '@jbrowse/core/util' // types +import { transaction } from 'mobx' +import { getSnapshot } from 'mobx-state-tree' import type { Assembly } from '@jbrowse/core/assemblyManager/assembly' import type { AbstractSessionModel, Feature } from '@jbrowse/core/util' +import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view' + +export interface Display { + id: string + [key: string]: unknown +} + +export interface Track { + id: string + displays: Display[] + [key: string]: unknown +} + +function stripIds(arr: Track[]) { + return arr.map(({ id, displays, ...rest }) => ({ + ...rest, + displays: displays.map(({ id, ...rest }) => rest), + })) +} export function getBreakendCoveringRegions({ feature, @@ -94,3 +115,163 @@ export function singleLevelSnapshotFromBreakendFeature({ }, } } + +export async function navToSingleLevelBreak({ + stableViewId, + feature, + assemblyName, + session, + tracks, + windowSize = 0, +}: { + stableViewId?: string + feature: Feature + assemblyName: string + windowSize?: number + session: AbstractSessionModel + tracks?: any +}) { + const { snap, coverage } = singleLevelSnapshotFromBreakendFeature({ + feature, + assemblyName, + session, + }) + const { refName, pos: startPos, mateRefName, matePos: endPos } = coverage + let viewInStack = session.views.find(f => f.id === stableViewId) as + | { views: any[] } + | undefined + + if (!viewInStack) { + viewInStack = session.addView('BreakpointSplitView', { + ...snap, + views: [ + { + ...snap.views[0], + tracks: tracks ? stripIds(getSnapshot(tracks)) : [], + }, + ], + }) as unknown as { views: LinearGenomeViewModel[] } + } else { + viewInStack.views[0]?.setDisplayedRegions(snap.views[0]!.displayedRegions) + // @ts-expect-error + viewInStack.setDisplayName(snap.displayName) + } + const lgv = viewInStack.views[0]! + await when(() => lgv.initialized) + + const l0 = lgv.bpToPx({ + coord: Math.max(0, startPos - windowSize), + refName, + }) + const r0 = lgv.bpToPx({ + coord: endPos + windowSize, + refName: mateRefName, + }) + if (l0 && r0) { + lgv.moveTo({ ...l0, offset: l0.offsetPx }, { ...r0, offset: r0.offsetPx }) + } else { + getSession(lgv).notify('Unable to navigate to breakpoint') + } +} + +export async function navToMultiLevelBreak({ + stableViewId, + feature, + assemblyName, + session, + tracks, +}: { + stableViewId?: string + feature: Feature + assemblyName: string + windowSize?: number + session: AbstractSessionModel + tracks?: any +}) { + const bpPerPx = 10 + + const { assemblyManager } = session + const assembly = assemblyManager.get(assemblyName) + if (!assembly) { + throw new Error(`assembly ${assemblyName} not found`) + } + if (!assembly.regions) { + throw new Error(`assembly ${assemblyName} regions not loaded`) + } + const { + refName, + pos: startPos, + mateRefName, + matePos: endPos, + } = getBreakendCoveringRegions({ + feature, + assembly, + }) + + const topRegion = assembly.regions.find(f => f.refName === refName)! + const bottomRegion = assembly.regions.find(f => f.refName === mateRefName)! + const topMarkedRegion = [{ ...topRegion }, { ...topRegion }] + const bottomMarkedRegion = [{ ...bottomRegion }, { ...bottomRegion }] + topMarkedRegion[0]!.end = startPos + topMarkedRegion[1]!.start = startPos + bottomMarkedRegion[0]!.end = endPos + bottomMarkedRegion[1]!.start = endPos + const snap = { + type: 'BreakpointSplitView', + views: [ + { + type: 'LinearGenomeView', + displayedRegions: topMarkedRegion, + hideHeader: true, + bpPerPx, + offsetPx: (topRegion.start + feature.get('start')) / bpPerPx, + }, + { + type: 'LinearGenomeView', + displayedRegions: bottomMarkedRegion, + hideHeader: true, + bpPerPx, + tracks, + offsetPx: (bottomRegion.start + endPos) / bpPerPx, + }, + ], + displayName: `${ + feature.get('name') || feature.get('id') || 'breakend' + } split detail`, + } + + let viewInStack = session.views.find(f => f.id === stableViewId) as + | { views: any[] } + | undefined + + if (!viewInStack) { + viewInStack = session.addView('BreakpointSplitView', { + ...snap, + id: stableViewId, + views: [ + { + ...snap.views[0], + tracks: tracks ? stripIds(getSnapshot(tracks)) : [], + }, + { + ...snap.views[1], + tracks: (tracks ? stripIds(getSnapshot(tracks)) : []).reverse(), + }, + ], + }) as unknown as { views: LinearGenomeViewModel[] } + } else { + // re-nav existing view + transaction(() => { + for (let i = 0; i < viewInStack!.views.length; i++) { + const s = snap.views[i] + if (s) { + viewInStack!.views[i].setDisplayedRegions(s.displayedRegions) + viewInStack!.views[i].scrollTo(s.offsetPx - 800) + viewInStack!.views[i].zoomTo(s.bpPerPx) + } + } + // @ts-expect-error + viewInStack!.setDisplayName(snap.displayName) + }) + } +} diff --git a/plugins/alignments/src/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.tsx b/plugins/alignments/src/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.tsx index 4aa19b3d52..ee21278b4d 100644 --- a/plugins/alignments/src/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.tsx +++ b/plugins/alignments/src/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.tsx @@ -5,7 +5,6 @@ import { Link, Typography } from '@mui/material' // types import type { AlignmentFeatureWidgetModel } from './stateModelFactory' -import type { ViewType } from '@jbrowse/core/pluggableElementTypes' import type { SimpleFeatureSerialized } from '@jbrowse/core/util' // lazies diff --git a/plugins/alignments/src/AlignmentsFeatureDetail/LaunchSupplementaryAlignmentBreakpointSplitViewPanel.tsx b/plugins/alignments/src/AlignmentsFeatureDetail/LaunchSupplementaryAlignmentBreakpointSplitViewPanel.tsx index 279ae4ef2f..961c660e56 100644 --- a/plugins/alignments/src/AlignmentsFeatureDetail/LaunchSupplementaryAlignmentBreakpointSplitViewPanel.tsx +++ b/plugins/alignments/src/AlignmentsFeatureDetail/LaunchSupplementaryAlignmentBreakpointSplitViewPanel.tsx @@ -8,7 +8,6 @@ import { getSAFeatures } from './getSAFeatures' import type { ReducedFeature } from './getSAFeatures' import type { AlignmentFeatureWidgetModel } from './stateModelFactory' -import type { ViewType } from '@jbrowse/core/pluggableElementTypes' import type { SimpleFeatureSerialized } from '@jbrowse/core/util' // locals diff --git a/plugins/alignments/src/AlignmentsFeatureDetail/SupplementaryAlignments.tsx b/plugins/alignments/src/AlignmentsFeatureDetail/SupplementaryAlignments.tsx index a738e53644..07231c5603 100644 --- a/plugins/alignments/src/AlignmentsFeatureDetail/SupplementaryAlignments.tsx +++ b/plugins/alignments/src/AlignmentsFeatureDetail/SupplementaryAlignments.tsx @@ -7,10 +7,6 @@ import LaunchBreakpointSplitViewPanel from './LaunchSupplementaryAlignmentBreakp import SupplementaryAlignmentsLocStrings from './SupplementaryAlignmentsLocStrings' import type { AlignmentFeatureWidgetModel } from './stateModelFactory' -import type { ViewType } from '@jbrowse/core/pluggableElementTypes' - -// locals - import type { SimpleFeatureSerialized } from '@jbrowse/core/util' export default function SupplementaryAlignments(props: { diff --git a/plugins/breakpoint-split-view/src/BreakpointSplitView/BreakpointSplitView.ts b/plugins/breakpoint-split-view/src/BreakpointSplitView/BreakpointSplitView.ts index e6c9675ce0..e982984319 100644 --- a/plugins/breakpoint-split-view/src/BreakpointSplitView/BreakpointSplitView.ts +++ b/plugins/breakpoint-split-view/src/BreakpointSplitView/BreakpointSplitView.ts @@ -1,12 +1,12 @@ import { parseBreakend } from '@gmod/vcf' import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType' -import type { Assembly } from '@jbrowse/core/assemblyManager/assembly' import { gatherOverlaps, type AbstractSessionModel, type Feature, } from '@jbrowse/core/util' +import type { Assembly } from '@jbrowse/core/assemblyManager/assembly' export default class BreakpointSplitViewType extends ViewType { getBreakendCoveringRegions({ diff --git a/plugins/grid-bookmark/src/GridBookmarkWidget/components/BookmarkGrid.tsx b/plugins/grid-bookmark/src/GridBookmarkWidget/components/BookmarkGrid.tsx index a5f2c89006..930a5dd994 100644 --- a/plugins/grid-bookmark/src/GridBookmarkWidget/components/BookmarkGrid.tsx +++ b/plugins/grid-bookmark/src/GridBookmarkWidget/components/BookmarkGrid.tsx @@ -1,5 +1,4 @@ -import React, { lazy } from 'react' - +import React from 'react' import ColorPicker from '@jbrowse/core/ui/ColorPicker' import { assembleLocString, diff --git a/plugins/sv-inspector/src/SvInspectorView/index.ts b/plugins/sv-inspector/src/SvInspectorView/index.ts index f0b7faac1b..7de6d59849 100644 --- a/plugins/sv-inspector/src/SvInspectorView/index.ts +++ b/plugins/sv-inspector/src/SvInspectorView/index.ts @@ -1,52 +1,38 @@ import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType' import { getContainingView, getSession } from '@jbrowse/core/util' +import { navToMultiLevelBreak } from '@jbrowse/sv-core' +import { getParent, type IAnyStateTreeNode } from 'mobx-state-tree' // locals import ReactComponent from './components/SvInspectorView' import stateModelFactory from './model' -import type PluginManager from '@jbrowse/core/PluginManager' - // types +import type { SvInspectorViewModel } from './model' +import type PluginManager from '@jbrowse/core/PluginManager' import type { Feature } from '@jbrowse/core/util' import type { CircularViewModel } from '@jbrowse/plugin-circular-view' -import type { IAnyStateTreeNode } from 'mobx-state-tree' -import { singleLevelSnapshotFromBreakendFeature } from '@jbrowse/sv-core' function defaultOnChordClick(feature: Feature, chordTrack: IAnyStateTreeNode) { - const session = getSession(chordTrack) - session.setSelection(feature) - const view = getContainingView(chordTrack) as CircularViewModel - const { coverage, snap } = singleLevelSnapshotFromBreakendFeature({ - feature, - view, - }) - - // try to center the offsetPx - snap.views[0]!.offsetPx -= view.width / 2 + 100 - snap.views[1]!.offsetPx -= view.width / 2 + 100 - - const newViewId = `${chordTrack.id}_spawned` - const viewInStack = session.views.find(v => v.id === newViewId) - - // new view - if (!viewInStack) { - session.addView('BreakpointSplitView', { - ...viewSnapshot, - id: newViewId, - }) - } - - // re-nav existing view - else { - // @ts-expect-error - const { views } = viewInStack - for (let i = 0; i < views.length; i++) { - views[i].setDisplayedRegions(viewSnapshot.views[i]?.displayedRegions) - views[i].scrollTo(viewSnapshot.views[0]?.offsetPx) - views[i].zoom(viewSnapshot.views[0]?.bpPerPx) + // eslint-disable-next-line @typescript-eslint/no-floating-promises + ;(async () => { + const session = getSession(chordTrack) + try { + session.setSelection(feature) + const view = getContainingView(chordTrack) as CircularViewModel + const parentView = getParent(view) as SvInspectorViewModel + const stableViewId = `${parentView.id}_spawned` + await navToMultiLevelBreak({ + assemblyName: view.assemblyNames[0]!, + session, + stableViewId, + feature, + }) + } catch (e) { + console.error(e) + session.notifyError(`${e}`, e) } - } + })() } export default function SvInspectorViewF(pluginManager: PluginManager) { diff --git a/plugins/sv-inspector/src/SvInspectorView/model.ts b/plugins/sv-inspector/src/SvInspectorView/model.ts index 86089baea7..3f9aa04ab4 100644 --- a/plugins/sv-inspector/src/SvInspectorView/model.ts +++ b/plugins/sv-inspector/src/SvInspectorView/model.ts @@ -331,6 +331,7 @@ function SvInspectorViewF(pluginManager: PluginManager) { assemblyName: self.assemblyName, }), data => { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (!data) { return } diff --git a/plugins/variants/src/VariantFeatureWidget/LaunchBreakendPanel.tsx b/plugins/variants/src/VariantFeatureWidget/LaunchBreakendPanel.tsx index 401d99a9b2..a28ebcd67b 100644 --- a/plugins/variants/src/VariantFeatureWidget/LaunchBreakendPanel.tsx +++ b/plugins/variants/src/VariantFeatureWidget/LaunchBreakendPanel.tsx @@ -4,12 +4,10 @@ import BaseCard from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard import { SimpleFeature, getEnv, getSession } from '@jbrowse/core/util' import { Link, Typography } from '@mui/material' +// types import type { VariantFeatureWidgetModel } from './stateModelFactory' -import type { ViewType } from '@jbrowse/core/pluggableElementTypes' import type { SimpleFeatureSerialized } from '@jbrowse/core/util' -// locals - // lazies const BreakendMultiLevelOptionDialog = lazy( () => import('./BreakendMultiLevelOptionDialog'), @@ -66,12 +64,10 @@ function LaunchBreakpointSplitViewPanel({ locStrings, model, feature, - viewType, }: { locStrings: string[] model: VariantFeatureWidgetModel feature: SimpleFeatureSerialized - viewType: ViewType }) { const session = getSession(model) const simpleFeature = new SimpleFeature(feature) @@ -136,10 +132,10 @@ export default function BreakendPanel(props: { const { model, locStrings, feature } = props const session = getSession(model) const { pluginManager } = getEnv(session) - let viewType: ViewType | undefined + let hasBreakpointSplitView = false try { - viewType = pluginManager.getViewType('BreakpointSplitView') + hasBreakpointSplitView = !!pluginManager.getViewType('BreakpointSplitView') } catch (e) { // ignore } @@ -147,9 +143,8 @@ export default function BreakendPanel(props: { return ( - {viewType ? ( + {hasBreakpointSplitView ? ( { expect(field.innerHTML).toContain('new label') }) -test('Edit a bookmark label with a double click via the dialog', async () => { - const { session, findByText, findAllByRole, findByTestId } = - await createView() - - const user = userEvent.setup() - await user.click(await findByText('Tools')) - await user.click(await findByText('Bookmarks')) - - // @ts-expect-error - const bookmarkWidget = session.widgets.get('GridBookmark') - bookmarkWidget.addBookmark({ - start: 200, - end: 240, - refName: 'ctgA', - assemblyName: 'volvox', - }) - - const field = (await findAllByRole('gridcell'))[2]! - - await user.dblClick(field) - await user.type(await findByTestId('edit-bookmark-label-field'), 'new label') - await user.click(await findByText('Confirm')) - expect(field.innerHTML).toContain('new label') -}) test('Toggle highlight visibility across all views', async () => { const { session, findByText, findByTestId, findAllByTestId } = diff --git a/products/jbrowse-web/src/tests/util.tsx b/products/jbrowse-web/src/tests/util.tsx index 456517f130..59ba3ebf24 100644 --- a/products/jbrowse-web/src/tests/util.tsx +++ b/products/jbrowse-web/src/tests/util.tsx @@ -10,16 +10,15 @@ import { Image, createCanvas } from 'canvas' import { LocalFile } from 'generic-filehandle' import { toMatchImageSnapshot } from 'jest-image-snapshot' import rangeParser from 'range-parser' -// types // locals import configSnapshot from '../../test_data/volvox/config.json' -import JBrowseWithoutQueryParamProvider from '../components/JBrowse' import corePlugins from '../corePlugins' import JBrowseRootModelFactory from '../rootModel/rootModel' import sessionModelFactory from '../sessionModel' import JBrowse from './TestingJBrowse' +// types import type { AbstractSessionModel, AppRootModel } from '@jbrowse/core/util' import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view' import type { GenericFilehandle } from 'generic-filehandle' diff --git a/webpack/config/env.js b/webpack/config/env.js index 7279e249fd..24c6b7e9c3 100644 --- a/webpack/config/env.js +++ b/webpack/config/env.js @@ -1,6 +1,5 @@ const fs = require('fs') const path = require('path') - const paths = require('./paths') // Make sure that including paths.js after env.js will read .env variables. diff --git a/webpack/config/getHttpsConfig.js b/webpack/config/getHttpsConfig.js index 21b6da3c69..a5cd00ab49 100644 --- a/webpack/config/getHttpsConfig.js +++ b/webpack/config/getHttpsConfig.js @@ -2,7 +2,6 @@ const crypto = require('crypto') const fs = require('fs') const path = require('path') const chalk = require('chalk') - const paths = require('./paths') // Ensure the certificate and key provided are valid and if not diff --git a/webpack/config/webpack.config.js b/webpack/config/webpack.config.js index 18fa174616..c36db1600d 100644 --- a/webpack/config/webpack.config.js +++ b/webpack/config/webpack.config.js @@ -10,7 +10,6 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin') const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent') const webpack = require('webpack') const { WebpackManifestPlugin } = require('webpack-manifest-plugin') - const getClientEnvironment = require('./env') const modules = require('./modules') const paths = require('./paths') diff --git a/webpack/scripts/build.js b/webpack/scripts/build.js index d7c9fd7b29..482314d443 100644 --- a/webpack/scripts/build.js +++ b/webpack/scripts/build.js @@ -17,6 +17,8 @@ const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles') const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages') const printBuildError = require('react-dev-utils/printBuildError') const printHostingInstructions = require('react-dev-utils/printHostingInstructions') +const webpack = require('webpack') +const paths = require('../config/paths') const measureFileSizesBeforeBuild = FileSizeReporter.measureFileSizesBeforeBuild const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild @@ -38,9 +40,6 @@ const writeStatsJson = argv.includes('--stats') // We require that you explicitly set browsers and do not fall back to // browserslist defaults. -const webpack = require('webpack') - -const paths = require('../config/paths') module.exports = function buildWebpack(config) { return checkBrowsers(paths.appPath, isInteractive) diff --git a/webpack/scripts/start.js b/webpack/scripts/start.js index f518dc1b96..30cdcc6c3d 100644 --- a/webpack/scripts/start.js +++ b/webpack/scripts/start.js @@ -20,7 +20,6 @@ const clearConsole = require('react-dev-utils/clearConsole') const openBrowser = require('react-dev-utils/openBrowser') const webpack = require('webpack') const WebpackDevServer = require('webpack-dev-server') - const paths = require('../config/paths') const useYarn = fs.existsSync(paths.yarnLockFile)