File tree 9 files changed +28
-25
lines changed
client/components/react-dev-overlay
9 files changed +28
-25
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ import { useUntrackedPathname } from '../../navigation-untracked'
43
43
import { getComponentStack , getOwnerStack } from '../../errors/stitched-error'
44
44
import { handleDevBuildIndicatorHmrEvents } from '../../../dev/dev-build-indicator/internal/handle-dev-build-indicator-hmr-events'
45
45
import type { GlobalErrorComponent } from '../../global-error'
46
- import type { DevIndicatorServerState } from '../../../../server/dev/dev-indicator -server-state'
46
+ import type { DevToolsServerState } from '../../../../server/dev/dev-tools -server-state'
47
47
import reportHmrLatency from '../utils/report-hmr-latency'
48
48
import { TurbopackHmr } from '../utils/turbopack-hot-reloader-common'
49
49
import { NEXT_HMR_REFRESH_HASH_COOKIE } from '../../app-router-headers'
@@ -56,7 +56,7 @@ export interface Dispatcher {
56
56
onBeforeRefresh ( ) : void
57
57
onRefresh ( ) : void
58
58
onStaticIndicator ( status : boolean ) : void
59
- onDevIndicator ( devIndicator : DevIndicatorServerState ) : void
59
+ onDevIndicator ( devIndicator : DevToolsServerState [ 'devIndicator' ] ) : void
60
60
}
61
61
62
62
let mostRecentCompilationHash : any = null
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import {
18
18
} from '../shared'
19
19
import type { VersionInfo } from '../../../../server/dev/parse-version-info'
20
20
import { getComponentStack , getOwnerStack } from '../../errors/stitched-error'
21
- import type { DevIndicatorServerState } from '../../../../server/dev/dev-indicator -server-state'
21
+ import type { DevToolsServerState } from '../../../../server/dev/dev-tools -server-state'
22
22
23
23
let isRegistered = false
24
24
@@ -126,8 +126,10 @@ export function onStaticIndicator(isStatic: boolean) {
126
126
Bus . emit ( { type : ACTION_STATIC_INDICATOR , staticIndicator : isStatic } )
127
127
}
128
128
129
- export function onDevIndicator ( devIndicatorsState : DevIndicatorServerState ) {
130
- Bus . emit ( { type : ACTION_DEV_INDICATOR , devIndicator : devIndicatorsState } )
129
+ export function onDevIndicator (
130
+ devIndicator : DevToolsServerState [ 'devIndicator' ]
131
+ ) {
132
+ Bus . emit ( { type : ACTION_DEV_INDICATOR , devIndicator } )
131
133
}
132
134
133
135
export { getErrorByType } from '../utils/get-error-by-type'
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import type { VersionInfo } from '../../../server/dev/parse-version-info'
5
5
import type { SupportedErrorEvent } from './ui/container/runtime-error/render-error'
6
6
import type { ComponentStackFrame } from './utils/parse-component-stack'
7
7
import type { DebugInfo } from './types'
8
- import type { DevIndicatorServerState } from '../../../server/dev/dev-indicator -server-state'
8
+ import type { DevToolsServerState } from '../../../server/dev/dev-tools -server-state'
9
9
import type { HMR_ACTION_TYPES } from '../../../server/dev/hot-reloader-types'
10
10
import { getOwnerStack } from '../errors/stitched-error'
11
11
@@ -87,7 +87,7 @@ interface VersionInfoAction {
87
87
88
88
interface DevIndicatorAction {
89
89
type : typeof ACTION_DEV_INDICATOR
90
- devIndicator : DevIndicatorServerState
90
+ devIndicator : DevToolsServerState [ 'devIndicator' ]
91
91
}
92
92
93
93
export type BusEvent =
Original file line number Diff line number Diff line change 1
1
import type { ServerResponse , IncomingMessage } from 'http'
2
2
import { middlewareResponse } from '../../client/components/react-dev-overlay/server/middleware-response'
3
3
import * as Log from '../../build/output/log'
4
- import { devIndicatorServerState } from './dev-indicator -server-state'
4
+ import { devToolsServerState } from './dev-tools -server-state'
5
5
6
6
const DISABLE_DEV_INDICATOR_PREFIX = '/__nextjs_disable_dev_indicator'
7
7
@@ -27,7 +27,8 @@ export function getDisableDevIndicatorMiddleware() {
27
27
return middlewareResponse . methodNotAllowed ( res )
28
28
}
29
29
30
- devIndicatorServerState . disabledUntil = Date . now ( ) + COOLDOWN_TIME_MS
30
+ devToolsServerState . devIndicator . disabledUntil =
31
+ Date . now ( ) + COOLDOWN_TIME_MS
31
32
32
33
return middlewareResponse . noContent ( res )
33
34
} catch ( err ) {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ export type DevToolsServerState = typeof devToolsServerState
2
+
3
+ export const devToolsServerState = {
4
+ devIndicator : { disabledUntil : 0 } ,
5
+ }
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import { isMiddlewareFilename } from '../../build/utils'
27
27
import type { VersionInfo } from './parse-version-info'
28
28
import type { HMR_ACTION_TYPES } from './hot-reloader-types'
29
29
import { HMR_ACTIONS_SENT_TO_BROWSER } from './hot-reloader-types'
30
- import { devIndicatorServerState } from './dev-indicator -server-state'
30
+ import { devToolsServerState } from './dev-tools -server-state'
31
31
32
32
function isMiddlewareStats ( stats : webpack . Stats ) {
33
33
for ( const key of stats . compilation . entrypoints . keys ( ) ) {
@@ -203,8 +203,8 @@ export class WebpackHotMiddleware {
203
203
const stats = statsToJson ( syncStats )
204
204
const middlewareStats = statsToJson ( this . middlewareLatestStats ?. stats )
205
205
206
- if ( devIndicatorServerState . disabledUntil < Date . now ( ) ) {
207
- devIndicatorServerState . disabledUntil = 0
206
+ if ( devToolsServerState . devIndicator . disabledUntil < Date . now ( ) ) {
207
+ devToolsServerState . devIndicator . disabledUntil = 0
208
208
}
209
209
210
210
this . publish ( {
@@ -219,7 +219,7 @@ export class WebpackHotMiddleware {
219
219
debug : {
220
220
devtoolsFrontendUrl : this . devtoolsFrontendUrl ,
221
221
} ,
222
- devIndicator : devIndicatorServerState ,
222
+ devIndicator : devToolsServerState . devIndicator ,
223
223
} )
224
224
}
225
225
}
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ import {
95
95
type TopLevelIssuesMap ,
96
96
} from '../../shared/lib/turbopack/utils'
97
97
import { getDevOverlayFontMiddleware } from '../../client/components/react-dev-overlay/font/get-dev-overlay-font-middleware'
98
- import { devIndicatorServerState } from './dev-indicator -server-state'
98
+ import { devToolsServerState } from './dev-tools -server-state'
99
99
import { getDisableDevIndicatorMiddleware } from './dev-indicator-middleware'
100
100
import { getRestartDevServerMiddleware } from '../../client/components/react-dev-overlay/server/restart-dev-server-middleware'
101
101
// import { getSupportedBrowsers } from '../../build/utils'
@@ -839,8 +839,8 @@ export async function createHotReloaderTurbopack(
839
839
}
840
840
}
841
841
842
- if ( devIndicatorServerState . disabledUntil < Date . now ( ) ) {
843
- devIndicatorServerState . disabledUntil = 0
842
+ if ( devToolsServerState . devIndicator . disabledUntil < Date . now ( ) ) {
843
+ devToolsServerState . devIndicator . disabledUntil = 0
844
844
}
845
845
846
846
; ( async function ( ) {
@@ -855,7 +855,7 @@ export async function createHotReloaderTurbopack(
855
855
debug : {
856
856
devtoolsFrontendUrl,
857
857
} ,
858
- devIndicator : devIndicatorServerState ,
858
+ devIndicator : devToolsServerState . devIndicator ,
859
859
}
860
860
861
861
sendToClient ( client , sync )
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import type { RouteDefinition } from '../route-definitions/route-definition'
7
7
import type { Project , Update as TurbopackUpdate } from '../../build/swc/types'
8
8
import type { VersionInfo } from './parse-version-info'
9
9
import type { DebugInfo } from '../../client/components/react-dev-overlay/types'
10
- import type { DevIndicatorServerState } from './dev-indicator -server-state'
10
+ import type { DevToolsServerState } from './dev-tools -server-state'
11
11
12
12
export const enum HMR_ACTIONS_SENT_TO_BROWSER {
13
13
ADDED_PAGE = 'addedPage' ,
@@ -57,7 +57,7 @@ export interface SyncAction {
57
57
versionInfo : VersionInfo
58
58
updatedModules ?: ReadonlyArray < string >
59
59
debug ?: DebugInfo
60
- devIndicator : DevIndicatorServerState
60
+ devIndicator : DevToolsServerState [ 'devIndicator' ]
61
61
}
62
62
interface BuiltAction {
63
63
action : HMR_ACTIONS_SENT_TO_BROWSER . BUILT
@@ -121,7 +121,7 @@ export interface AppIsrManifestAction {
121
121
122
122
export interface DevIndicatorAction {
123
123
action : HMR_ACTIONS_SENT_TO_BROWSER . DEV_INDICATOR
124
- devIndicator : DevIndicatorServerState
124
+ devIndicator : DevToolsServerState
125
125
}
126
126
127
127
export type HMR_ACTION_TYPES =
You can’t perform that action at this time.
0 commit comments